Add trim name method helper to create name only references
Add a simple helper to create name only references without having to first get the name as a string and reparse. This method does not fail so ignoring or checking error to simply trim reference is not required. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
4ad885a672
commit
31a91e419c
1 changed files with 5 additions and 0 deletions
|
@ -261,6 +261,11 @@ func Match(pattern string, ref Reference) (bool, error) {
|
||||||
return matched, err
|
return matched, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TrimNamed removes any tag or digest from the named reference.
|
||||||
|
func TrimNamed(ref Named) Named {
|
||||||
|
return repository(ref.Name())
|
||||||
|
}
|
||||||
|
|
||||||
func getBestReferenceType(ref reference) Reference {
|
func getBestReferenceType(ref reference) Reference {
|
||||||
if ref.name == "" {
|
if ref.name == "" {
|
||||||
// Allow digest only references
|
// Allow digest only references
|
||||||
|
|
Loading…
Reference in a new issue