File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ type Encoder interface {
5151// - the field is empty and its tag specifies the "omitempty" option
5252//
5353// The empty values are false, 0, any nil pointer or interface value, any array
54- // slice, map, or string of length zero, and any time.Time that returns true
55- // for IsZero().
54+ // slice, map, or string of length zero, and any type (such as time.Time) that
55+ // returns true for IsZero().
5656//
5757// The URL parameter name defaults to the struct field name but can be
5858// specified in the struct field's tag value. The "url" key in the struct
@@ -294,8 +294,12 @@ func isEmptyValue(v reflect.Value) bool {
294294 return v .IsNil ()
295295 }
296296
297- if v .Type () == timeType {
298- return v .Interface ().(time.Time ).IsZero ()
297+ type zeroable interface {
298+ IsZero () bool
299+ }
300+
301+ if z , ok := v .Interface ().(zeroable ); ok {
302+ return z .IsZero ()
299303 }
300304
301305 return false
You can’t perform that action at this time.
0 commit comments