Skip to content

Commit

Permalink
For a 38-char UUID, require '{' and '}' characters
Browse files Browse the repository at this point in the history
It was not intentional to simply ignore these characters, and examples/docs/tests all indicate that curly braces were the intended characters. See google#60
  • Loading branch information
Carrotman42 committed May 19, 2020
1 parent cb32006 commit 7188ad7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func Parse(s string) (UUID, error) {

// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
case 36 + 2:
if s[0] != '{' || s[37] != '}' {
return uuid, fmt.Errorf("invalid prefix/suffix: got %q and %q, want '{' and '}'", s[0], s[37])
}
s = s[1:]

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Expand Down

0 comments on commit 7188ad7

Please sign in to comment.