summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-27 03:36:25 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-01 18:22:58 +0000
commite8f7442831ed1d5b950eee880b44ffb80348c996 (patch)
tree5b54e384cefaa0c108d29eabf54f453c9436d8fd
parentd4dbe6677439b91e55ee48c23edfd8f80d61c05d (diff)
downloadpodman-e8f7442831ed1d5b950eee880b44ffb80348c996.tar.gz
podman-e8f7442831ed1d5b950eee880b44ffb80348c996.tar.bz2
podman-e8f7442831ed1d5b950eee880b44ffb80348c996.zip
Use an early exit if a docker-archive: image has no repo tags
This avoids another "append an only item to an empty array" pattern, and will allow us to get rid of the "dest" variable entirely. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
-rw-r--r--libpod/image/pull.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 406fa0eaf..378664e83 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -109,18 +109,17 @@ func refNamesFromImageReference(ctx context.Context, srcRef types.ImageReference
return []*pullRefName{getPullRefName(srcRef, reference)}, nil
}
- var dest []string
if len(manifest[0].RepoTags) == 0 {
// If the input image has no repotags, we need to feed it a dest anyways
digest, err := getImageDigest(ctx, srcRef, sc)
if err != nil {
return nil, err
}
- dest = append(dest, digest)
- } else {
- // Need to load in all the repo tags from the manifest
- dest = append(dest, manifest[0].RepoTags...)
+ return []*pullRefName{getPullRefName(srcRef, digest)}, nil
}
+
+ // Need to load in all the repo tags from the manifest
+ dest := manifest[0].RepoTags
res := []*pullRefName{}
for _, dst := range dest {
pullInfo := getPullRefName(srcRef, dst)