I have written the following method:
func (c *Component) Encode(w io.Writer){
//encodes c and writes the bytes into w, containing a few CRLF linebreaks
}
I also wrote the function demonstrating the encoder:
func ExampleComponent_Encode() {
c := &Component{
Name: "DESCRIPTION",
}
c.Encode(os.Stdout)
//Output:
//BEGIN:DESCRIPTION
//END:DESCRIPTION
}
The Problem is now that this example fails the go test
command because the linebreaks in the comments are \n linebreaks (I'm on Linux) while the linebreaks generated by c.Encode
have to be \r\n(CRLF) linebreaks (as defined by some spec).
How can i get the example to not fail go test
while also keeping it straightforward? Is there perhaps a way to hint go test/godoc on the linebreaks or get them to be more lenient?
I propably can hand-edit the linebreaks on these two lines or possibly the whole codebase but that will be pretty fragile and I want to avoid this solution.