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

Function ToNameTagPairs

libimage/normalize.go:115–136  ·  view source on GitHub ↗

ToNameTagsPairs splits repoTags into name&tag pairs. Guaranteed to return at least one pair.

(repoTags []reference.Named)

Source from the content-addressed store, hash-verified

113// ToNameTagsPairs splits repoTags into name&tag pairs.
114// Guaranteed to return at least one pair.
115func ToNameTagPairs(repoTags []reference.Named) ([]NameTagPair, error) {
116 none := "<none>"
117
118 var pairs []NameTagPair
119 for i, named := range repoTags {
120 pair := NameTagPair{
121 Name: named.Name(),
122 Tag: none,
123 named: repoTags[i],
124 }
125
126 if tagged, isTagged := named.(reference.NamedTagged); isTagged {
127 pair.Tag = tagged.Tag()
128 }
129 pairs = append(pairs, pair)
130 }
131
132 if len(pairs) == 0 {
133 pairs = append(pairs, NameTagPair{Name: none, Tag: none})
134 }
135 return pairs, nil
136}
137
138// normalizeTaggedDigestedString strips the tag off the specified string iff it
139// is tagged and digested. Note that the tag is entirely ignored to match

Callers 2

inRepoTagsMethod · 0.85
diskUsageForImageFunction · 0.85

Calls 1

TagMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…