Skip to content

Commit ac097ff

Browse files
committed
Use uuid.Validate for cases where the UUID isn't used
In google/uuid#141 a new `Validate` function was added to the `uuid` package. This can be used when no UUID struct is required, so can be used instead of `Parse`. This takes #1087, but uses `uuid.Validate` in one location.
1 parent d55769a commit ac097ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

command/api/token/create.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ func createAction(ctx *cli.Context) (err error) {
9494
Bundle: clientCert.Certificate,
9595
Audience: ctx.String("audience"),
9696
}
97-
if _, err := uuid.Parse(teamID); err == nil {
98-
r.TeamID = teamID
99-
} else {
97+
if err := uuid.Validate(teamID); err != nil {
10098
r.TeamSlug = teamID
99+
} else {
100+
r.TeamID = teamID
101101
}
102102
err = json.NewEncoder(b).Encode(r)
103103
if err != nil {

0 commit comments

Comments
 (0)