From 251e6b7730c7b31b600e6fe06162e541f3032604 Mon Sep 17 00:00:00 2001 From: Nicholas Wilson Date: Wed, 24 Jul 2019 12:32:43 +0100 Subject: [PATCH] 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. --- pgtype/convert.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgtype/convert.go b/pgtype/convert.go index ee6907c4..029e3d48 100644 --- a/pgtype/convert.go +++ b/pgtype/convert.go @@ -149,7 +149,7 @@ func underlyingTimeType(val interface{}) (interface{}, bool) { switch refVal.Kind() { case reflect.Ptr: if refVal.IsNil() { - return time.Time{}, false + return nil, false } convVal := refVal.Elem().Interface() return convVal, true @@ -160,7 +160,7 @@ func underlyingTimeType(val interface{}) (interface{}, bool) { 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