Skip to content

Commit

Permalink
refactor (*UUID).UnmarshalText (#58)
Browse files Browse the repository at this point in the history
Now it's easier to set breakpoint on error for debugging.
  • Loading branch information
prochac authored May 19, 2020
1 parent bd45158 commit cb32006
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cb32006

Please sign in to comment.