MCPcopy Create free account
hub / github.com/docker/secrets-engine / ParseID

Function ParseID

x/secrets/identifiers.go:161–167  ·  view source on GitHub ↗

ParseID creates a new [ID] from a string If a validation error occurs, it returns nil and the error. Rules: - Components separated by '/' - Each component is non-empty - Only characters A-Z, a-z, 0-9, '.', '_', '-' or ':' - No leading, trailing, or double slashes

(s string)

Source from the content-addressed store, hash-verified

159// - Only characters A-Z, a-z, 0-9, '.', '_', '-' or ':'
160// - No leading, trailing, or double slashes
161func ParseID(s string) (ID, error) {
162 if err := valid(s); err != nil {
163 return nil, err
164 }
165
166 return id(s), nil
167}
168
169// MustParseID parses a string into a [ID] and behaves similar to
170// [ParseID], however, it panics when the id is invalid

Callers 2

TestParseIDNewFunction · 0.85
TestMatchNewFunction · 0.85

Calls 2

idTypeAlias · 0.85
validFunction · 0.70

Tested by 2

TestParseIDNewFunction · 0.68
TestMatchNewFunction · 0.68