-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Labels
bugSomething isn't workingSomething isn't working
Description
$ cat struct_tag.go
package fixtures
type MyEntity struct {
tableName struct{} `myTag:"value1" myTag:"value2"`
}
$ golines struct_tag.go
package fixtures
type MyEntity struct {
tableName struct{} `myTag:"value1"`
}Suppose that myLibrary's tag parser has the behaviour of appending values when a tag key is repeated (myTag:"value1" myTag:"value2" -> "value1,value2"), golines in this case will break my code.
I know that this isn't the behaviour of reflect (its Get method on the tag would take just the first value) but Go doesn't enforce any constraint on the syntax of struct tags so we can't know what people out there do with them.
This issue is caused by the assumption that struct tags always comply with the convention described in https://pkg.go.dev/reflect#StructTag (thus that tag keys are unique) in alignTags [code].
PeterCardenas
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working