From cb32006e483f2a23230e24209cf185c65b477dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Proch=C3=A1zka?= Date: Tue, 19 May 2020 16:17:26 +0200 Subject: [PATCH] refactor (*UUID).UnmarshalText (#58) Now it's easier to set breakpoint on error for debugging. --- marshal.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/marshal.go b/marshal.go index 7f9e0c6..14bd340 100644 --- a/marshal.go +++ b/marshal.go @@ -16,10 +16,11 @@ func (uuid UUID) MarshalText() ([]byte, error) { // UnmarshalText implements encoding.TextUnmarshaler. func (uuid *UUID) UnmarshalText(data []byte) error { id, err := ParseBytes(data) - if err == nil { - *uuid = id + if err != nil { + return err } - return err + *uuid = id + return nil } // MarshalBinary implements encoding.BinaryMarshaler.