Skip to content

Commit

Permalink
Simplify ExpandNames
Browse files Browse the repository at this point in the history
No need to hard-code the :tag / @digest syntax when there
already is an API returning the string representation.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>

Closes: #1361
Approved by: rhatdan
  • Loading branch information
mtrmac authored and rh-atomic-bot committed Feb 27, 2019
1 parent dcae0ac commit 003a2d2
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,7 @@ func ExpandNames(names []string, firstRegistry string, systemContext *types.Syst
name = named
}
name = reference.TagNameOnly(name)
tag := ""
digest := ""
if tagged, ok := name.(reference.NamedTagged); ok {
tag = ":" + tagged.Tag()
}
if digested, ok := name.(reference.Digested); ok {
digest = "@" + digested.Digest().String()
}
expanded = append(expanded, name.Name()+tag+digest)
expanded = append(expanded, name.String())
}
return expanded, nil
}
Expand Down

0 comments on commit 003a2d2

Please sign in to comment.