version: omitempty on String()
we already have set omitempty on the JSON version, but the String() method left in empty strings. Fix this
@@ -152,11 +152,13 @@ func (i *Info) String() string {
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
value := v.FieldByName(field.Name).String()
+ if value != "" {
fmt.Fprintf(w, "%s:\t%s", field.Name, value)
if i+1 < t.NumField() {
fmt.Fprintf(w, "\n")
}
}
+ }
w.Flush()
return b.String()
