MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / IsUuid

Function IsUuid

pkg/validation/validation.go:32–44  ·  view source on GitHub ↗

IsUuid requires that the string is a valid UUID

(val interface{})

Source from the content-addressed store, hash-verified

30
31// IsUuid requires that the string is a valid UUID
32func IsUuid(val interface{}) error {
33 if str, ok := val.(string); ok {
34 if _, err := uuid.Parse(str); err != nil {
35 return fmt.Errorf("not a valid UUID")
36 }
37 } else {
38 // otherwise we cannot convert the value into a string and cannot perform check
39 return fmt.Errorf("cannot check value on response of type %v", reflect.TypeOf(val).Name())
40 }
41
42 // the input is fine
43 return nil
44}
45
46func IsExistingFile(val interface{}) error {
47 if str, ok := val.(string); ok {

Callers 3

NewCmdCreateFunction · 0.92
NewCmdCreateFunction · 0.92
TestIsUUIDFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsUUIDFunction · 0.68