Merge pull request #2173 from aaronlehmann/tagnameonly
reference: Replace EnsureTagged with TagNameOnly
This commit is contained in:
commit
545102ea07
1 changed files with 4 additions and 5 deletions
|
@ -123,11 +123,10 @@ func (c canonicalReference) Familiar() Named {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnsureTagged adds the default tag "latest" to a reference if it only has
|
// TagNameOnly adds the default tag "latest" to a reference if it only has
|
||||||
// a repo name.
|
// a repo name.
|
||||||
func EnsureTagged(ref Named) NamedTagged {
|
func TagNameOnly(ref Named) Named {
|
||||||
namedTagged, ok := ref.(NamedTagged)
|
if IsNameOnly(ref) {
|
||||||
if !ok {
|
|
||||||
namedTagged, err := WithTag(ref, defaultTag)
|
namedTagged, err := WithTag(ref, defaultTag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Default tag must be valid, to create a NamedTagged
|
// Default tag must be valid, to create a NamedTagged
|
||||||
|
@ -137,7 +136,7 @@ func EnsureTagged(ref Named) NamedTagged {
|
||||||
}
|
}
|
||||||
return namedTagged
|
return namedTagged
|
||||||
}
|
}
|
||||||
return namedTagged
|
return ref
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseAnyReference parses a reference string as a possible identifier,
|
// ParseAnyReference parses a reference string as a possible identifier,
|
||||||
|
|
Loading…
Reference in a new issue