You've already forked step-ca-cli
mirror of
https://github.com/smallstep/cli.git
synced 2025-08-09 03:22:43 +03:00
Use uuid.Validate
for cases where the UUID isn't used
In https://github.com/google/uuid/pull/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 https://github.com/smallstep/cli/pull/1087, but uses `uuid.Validate` in one location.
This commit is contained in:
@@ -94,10 +94,10 @@ func createAction(ctx *cli.Context) (err error) {
|
|||||||
Bundle: clientCert.Certificate,
|
Bundle: clientCert.Certificate,
|
||||||
Audience: ctx.String("audience"),
|
Audience: ctx.String("audience"),
|
||||||
}
|
}
|
||||||
if _, err := uuid.Parse(teamID); err == nil {
|
if err := uuid.Validate(teamID); err != nil {
|
||||||
r.TeamID = teamID
|
|
||||||
} else {
|
|
||||||
r.TeamSlug = teamID
|
r.TeamSlug = teamID
|
||||||
|
} else {
|
||||||
|
r.TeamID = teamID
|
||||||
}
|
}
|
||||||
err = json.NewEncoder(b).Encode(r)
|
err = json.NewEncoder(b).Encode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user