MCPcopy Create free account
hub / github.com/containers/common / ResolveName

Method ResolveName

libimage/runtime.go:460–479  ·  view source on GitHub ↗

ResolveName resolves the specified name. If the name resolves to a local image, the fully resolved name will be returned. Otherwise, the name will be properly normalized. Note that an empty string is returned as is.

(name string)

Source from the content-addressed store, hash-verified

458//
459// Note that an empty string is returned as is.
460func (r *Runtime) ResolveName(name string) (string, error) {
461 if name == "" {
462 return "", nil
463 }
464 image, resolvedName, err := r.LookupImage(name, nil)
465 if err != nil && errors.Cause(err) != storage.ErrImageUnknown {
466 return "", err
467 }
468
469 if image != nil && !strings.HasPrefix(image.ID(), resolvedName) {
470 return resolvedName, err
471 }
472
473 normalized, err := NormalizeName(name)
474 if err != nil {
475 return "", err
476 }
477
478 return normalized.String(), nil
479}
480
481// imageReferenceMatchesContext return true if the specified reference matches
482// the platform (os, arch, variant) as specified by the lookup options.

Callers

nothing calls this directly

Calls 4

LookupImageMethod · 0.95
NormalizeNameFunction · 0.85
IDMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected