1
0
mirror of https://github.com/golang/go synced 2024-11-14 20:10:30 -07:00
Change-Id: I49f14328841cc2e950e244f4cd98c4dcea1f0987
This commit is contained in:
Jes Cok 2024-10-01 11:07:23 +08:00
parent 0b672df57e
commit 57030f26b0

View File

@ -1192,7 +1192,9 @@ func typeFields(t reflect.Type) structFields {
field.isZero = func(v reflect.Value) bool {
// Avoid panics calling IsZero on a nil interface or
// non-nil interface with nil pointer.
return v.IsNil() || (v.Elem().Kind() == reflect.Pointer && v.Elem().IsNil()) || v.Interface().(isZeroer).IsZero()
return v.IsNil() ||
(v.Elem().Kind() == reflect.Pointer && v.Elem().IsNil()) ||
v.Interface().(isZeroer).IsZero()
}
case t.Kind() == reflect.Pointer && t.Implements(isZeroerType):
field.isZero = func(v reflect.Value) bool {