MCPcopy Index your code
hub / github.com/docker/cli / checkContextNameForCreation

Function checkContextNameForCreation

cli/command/context/create.go:119–130  ·  view source on GitHub ↗
(s store.Reader, name string)

Source from the content-addressed store, hash-verified

117}
118
119func checkContextNameForCreation(s store.Reader, name string) error {
120 if err := store.ValidateContextName(name); err != nil {
121 return err
122 }
123 if _, err := s.GetMetadata(name); !errdefs.IsNotFound(err) {
124 if err != nil {
125 return fmt.Errorf("error while getting existing contexts: %w", err)
126 }
127 return fmt.Errorf("context %q already exists", name)
128 }
129 return nil
130}
131
132func createFromExistingContext(s store.ReaderWriter, name string, fromContextName string, opts createOptions) error {
133 if len(opts.endpoint) != 0 {

Callers 2

runImportFunction · 0.85
runCreateFunction · 0.85

Calls 1

GetMetadataMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…