2
0

Tidying: make underlyingTimeType consistent with other underlyingFooType

The first return value is ignored when returning false - so there's no
point returning an empty time.Time when it can be nil.
This commit is contained in:
Nicholas Wilson
2019-07-24 12:32:43 +01:00
parent fc020c24ac
commit 251e6b7730
+2 -2
View File
@@ -149,7 +149,7 @@ func underlyingTimeType(val interface{}) (interface{}, bool) {
switch refVal.Kind() { switch refVal.Kind() {
case reflect.Ptr: case reflect.Ptr:
if refVal.IsNil() { if refVal.IsNil() {
return time.Time{}, false return nil, false
} }
convVal := refVal.Elem().Interface() convVal := refVal.Elem().Interface()
return convVal, true return convVal, true
@@ -160,7 +160,7 @@ func underlyingTimeType(val interface{}) (interface{}, bool) {
return refVal.Convert(timeType).Interface(), true return refVal.Convert(timeType).Interface(), true
} }
return time.Time{}, false return nil, false
} }
// underlyingUUIDType gets the underlying type that can be converted to [16]byte // underlyingUUIDType gets the underlying type that can be converted to [16]byte