MCPcopy Create free account
hub / github.com/containers/image / WithTag

Function WithTag

docker/reference/reference.go:271–293  ·  view source on GitHub ↗

WithTag combines the name from "name" and the tag from "tag" to form a reference incorporating both the name and the tag.

(name Named, tag string)

Source from the content-addressed store, hash-verified

269// WithTag combines the name from "name" and the tag from "tag" to form a
270// reference incorporating both the name and the tag.
271func WithTag(name Named, tag string) (NamedTagged, error) {
272 if !anchoredTagRegexp.MatchString(tag) {
273 return nil, ErrTagInvalidFormat
274 }
275 var repo repository
276 if r, ok := name.(namedRepository); ok {
277 repo.domain = r.Domain()
278 repo.path = r.Path()
279 } else {
280 repo.path = name.Name()
281 }
282 if canonical, ok := name.(Canonical); ok {
283 return reference{
284 namedRepository: repo,
285 tag: tag,
286 digest: canonical.Digest(),
287 }, nil
288 }
289 return taggedReference{
290 namedRepository: repo,
291 tag: tag,
292 }, nil
293}
294
295// WithDigest combines the name from "name" and the digest from "digest" to form
296// a reference incorporating both the name and the digest.

Callers 8

ResolveFunction · 0.92
ResolveLocallyFunction · 0.92
GetRepositoryTagsFunction · 0.92
TagNameOnlyFunction · 0.85
TestWithTagFunction · 0.85
TestWithDigestFunction · 0.85

Calls 4

DomainMethod · 0.65
PathMethod · 0.65
NameMethod · 0.65
DigestMethod · 0.65

Tested by 3

TestWithTagFunction · 0.68
TestWithDigestFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…