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

Method Resolve

cli/command/idresolver/idresolver.go:60–73  ·  view source on GitHub ↗

Resolve will attempt to resolve an ID to a Name by querying the manager. Results are stored into a cache. If the `-n` flag is used in the command-line, resolution is disabled.

(ctx context.Context, t any, id string)

Source from the content-addressed store, hash-verified

58// Results are stored into a cache.
59// If the `-n` flag is used in the command-line, resolution is disabled.
60func (r *IDResolver) Resolve(ctx context.Context, t any, id string) (string, error) {
61 if r.noResolve {
62 return id, nil
63 }
64 if name, ok := r.cache[id]; ok {
65 return name, nil
66 }
67 name, err := r.get(ctx, t, id)
68 if err != nil {
69 return "", err
70 }
71 r.cache[id] = name
72 return name, nil
73}

Callers 9

TestResolveErrorFunction · 0.80
TestResolveWithCacheFunction · 0.80
TestResolveNodeFunction · 0.80
TestResolveServiceFunction · 0.80
PrintFunction · 0.80
generateTaskNamesFunction · 0.80
formatMethod · 0.80
taskNamesFunction · 0.80

Calls 1

getMethod · 0.95

Tested by 5

TestResolveErrorFunction · 0.64
TestResolveWithCacheFunction · 0.64
TestResolveNodeFunction · 0.64
TestResolveServiceFunction · 0.64