segmentio/golines

golines may output invalid code when \n is present in a struct tag.

EricIO opened this issue · 0 comments

For the input

package main

type Foo struct {
	Bar []string `parameter:"BAR" delimiter:"\n"`
}

golines will output the following invalid go code.

package main

type Foo struct {
	Bar []string `param:"CLIENT" delimiter:"
"`
}

Interestingly removing the first tag part will make golines output correctly formated code.

package main

type Foo struct {
	Bar []string `delimiter:"\n"`
}

outputs

package main

type Foo struct {
	Bar []string `delimiter:"\n"`
}