From e77fbed442c252dfadd77b1534260389597bdd4a Mon Sep 17 00:00:00 2001 From: deoxxa Date: Mon, 16 Mar 2015 11:22:31 +1100 Subject: [PATCH] scanner.Scan() can fail, so the error should be forwarded --- field.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/field.go b/field.go index e122adb4..8f5efa6d 100644 --- a/field.go +++ b/field.go @@ -27,9 +27,13 @@ func (field *Field) Set(value interface{}) error { if scanner, ok := field.Field.Addr().Interface().(sql.Scanner); ok { if v, ok := value.(reflect.Value); ok { - scanner.Scan(v.Interface()) + if err := scanner.Scan(v.Interface()); err != nil { + return err + } } else { - scanner.Scan(value) + if err := scanner.Scan(value); err != nil { + return err + } } } else { reflectValue, ok := value.(reflect.Value)