You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both encoding/json and encoding/xml have an "omitempty" struct tag option that
omits the corresponding field if its value is "empty". That's well-defined for
builtin types (e.g. int is 0, string is ""). It doesn't work well for named
types, whether they be time.Time or something a programmer has defined in their own
program.
I propose these two packages use
type isZeroer interface {
IsZero() bool
}
and use that where possible. time.Time already supports this.
I am prepared to do the work to implement this if there's consensus we should do it.
guregu, pyeremenko, bep, vvakame, dlebech and 11 more