Closed
Description
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.