segmentio / golines

A golang formatter that fixes long lines
MIT License
903 stars 56 forks source link

Remove tags with the same key #109

Open khaitranhq opened 11 months ago

khaitranhq commented 11 months ago

Hi. I am working with go-flag which uses tags of structs to work. Some of them can be repeated with the same key. However, when I used golines to format, it left only one tag and removed others.

Reproduce

Source code

package main

type TestType struct {
    Arg string `choice:"ab" choice:"b"`
}

func main() {}

And run command

golines ./main.go

Output

package main

type TestType struct {
        Arg string `choice:"ab"`
}

func main() {}

Format with gofmt

package main

type TestType struct {
    Arg string `choice:"ab" choice:"b"`
}

func main() {}