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

Function checkContextExists

cli/command/context/remove.go:74–83  ·  view source on GitHub ↗

checkContextExists returns an error if the context directory does not exist.

(dockerCli command.Cli, name string)

Source from the content-addressed store, hash-verified

72
73// checkContextExists returns an error if the context directory does not exist.
74func checkContextExists(dockerCli command.Cli, name string) error {
75 contextDir := dockerCli.ContextStore().GetStorageInfo(name).MetadataPath
76 _, err := os.Stat(contextDir)
77 if os.IsNotExist(err) {
78 return notFoundErr{fmt.Errorf("context %q does not exist", name)}
79 }
80 // Ignore other errors; if relevant, they will produce an error when
81 // performing the actual delete.
82 return nil
83}
84
85type notFoundErr struct{ error }
86

Callers 1

doRemoveFunction · 0.85

Calls 2

GetStorageInfoMethod · 0.65
ContextStoreMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…