1
0
mirror of https://github.com/google/uuid.git synced 2024-11-21 17:16:42 +02:00

refactor (*UUID).UnmarshalText (#58)

Now it's easier to set breakpoint on error for debugging.
This commit is contained in:
Tomáš Procházka 2020-05-19 16:17:26 +02:00 committed by GitHub
parent bd45158498
commit cb32006e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.