https://github.com/bigpigeon/tagfmt 除了对齐还可以对 tag key 排序和填充 tag value
一个简单例子
// tagfmt .
package main
type Example struct {
Data string `xml:"data" yaml:"data" json:"data"`
OtherData string `xml:"other_data" json:"other_data:omitempty" yaml:"other_data"`
}
// result
package main
type Example struct {
Data string `xml:"data" yaml:"data" json:"data"`
OtherData string `xml:"other_data" json:"other_data:omitempty" yaml:"other_data"`
}