Skip to content

Commit cb32006

Browse files
authored
refactor (*UUID).UnmarshalText (#58)
Now it's easier to set breakpoint on error for debugging.
1 parent bd45158 commit cb32006

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

marshal.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ func (uuid UUID) MarshalText() ([]byte, error) {
1616
// UnmarshalText implements encoding.TextUnmarshaler.
1717
func (uuid *UUID) UnmarshalText(data []byte) error {
1818
id, err := ParseBytes(data)
19-
if err == nil {
20-
*uuid = id
19+
if err != nil {
20+
return err
2121
}
22-
return err
22+
*uuid = id
23+
return nil
2324
}
2425

2526
// MarshalBinary implements encoding.BinaryMarshaler.

0 commit comments

Comments
 (0)