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

Function NewName

x/api/name.go:38–45  ·  view source on GitHub ↗

NewName creates a new [Name] from a string If a validation error occurs, it returns nil and the error.

(s string)

Source from the content-addressed store, hash-verified

36// NewName creates a new [Name] from a string
37// If a validation error occurs, it returns nil and the error.
38func NewName(s string) (Name, error) {
39 if err := validName(s); err != nil {
40 return nil, fmt.Errorf("parsing name: %w", err)
41 }
42 return &name{
43 value: s,
44 }, nil
45}
46
47// MustNewName creates a new Name as [NewName] does, but panics when a validation
48// error occurs.

Callers 2

Test_NameFunction · 0.85
MustNewNameFunction · 0.85

Calls 2

validNameFunction · 0.85
ErrorfMethod · 0.65

Tested by 1

Test_NameFunction · 0.68