refactor (*UUID).UnmarshalText (#58)
Now it's easier to set breakpoint on error for debugging.
diff --git a/marshal.go b/marshal.go
index 7f9e0c6..14bd340 100644
--- a/marshal.go
+++ b/marshal.go
@@ -16,10 +16,11 @@
// 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.