From e5c764ec3cc11982cdb8e127554e4ac61ce9a854 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Wed, 9 Jan 2019 21:11:32 +0100 Subject: Remove no longer used imageParts.assemble() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should not change behavior. Signed-off-by: Miloslav Trmač --- libpod/image/parts.go | 11 ----------- libpod/image/parts_test.go | 15 ++------------- 2 files changed, 2 insertions(+), 24 deletions(-) (limited to 'libpod') diff --git a/libpod/image/parts.go b/libpod/image/parts.go index 8d059e35b..566a3842c 100644 --- a/libpod/image/parts.go +++ b/libpod/image/parts.go @@ -1,7 +1,6 @@ package image import ( - "fmt" "strings" "github.com/containers/image/docker/reference" @@ -93,13 +92,3 @@ func (ip *imageParts) referenceWithRegistry(registry string) (reference.Named, e } return ref, nil } - -// assemble concatenates an image's parts into a string -func (ip *imageParts) assemble() string { - spec := fmt.Sprintf("%s:%s", ip.name, ip.tag) - - if ip.registry != "" { - spec = fmt.Sprintf("%s/%s", ip.registry, spec) - } - return spec -} diff --git a/libpod/image/parts_test.go b/libpod/image/parts_test.go index b2cc0f8c0..3ca39b1dc 100644 --- a/libpod/image/parts_test.go +++ b/libpod/image/parts_test.go @@ -14,43 +14,33 @@ func TestDecompose(t *testing.T) { input string registry, name, tag string isTagged, hasRegistry bool - assembled string }{ - {"#", "", "", "", false, false, ""}, // Entirely invalid input + {"#", "", "", "", false, false}, // Entirely invalid input { // Fully qualified docker.io, name-only input "docker.io/library/busybox", "docker.io", "library/busybox", "latest", false, true, - "docker.io/library/busybox:latest", }, { // Fully qualified example.com, name-only input "example.com/ns/busybox", "example.com", "ns/busybox", "latest", false, true, - "example.com/ns/busybox:latest", }, { // Unqualified single-name input "busybox", "", "busybox", "latest", false, false, - "busybox:latest", }, { // Unqualified namespaced input "ns/busybox", "", "ns/busybox", "latest", false, false, - "ns/busybox:latest", }, { // name:tag "example.com/ns/busybox:notlatest", "example.com", "ns/busybox", "notlatest", true, true, - "example.com/ns/busybox:notlatest", }, { // name@digest // FIXME? .tag == "none" "example.com/ns/busybox" + digestSuffix, "example.com", "ns/busybox", "none", false, true, - // FIXME: this drops the digest and replaces it with an incorrect tag. - "example.com/ns/busybox:none", }, { // name:tag@digest "example.com/ns/busybox:notlatest" + digestSuffix, "example.com", "ns/busybox", "notlatest", true, true, - // FIXME: This drops the digest - "example.com/ns/busybox:notlatest", }, } { parts, err := decompose(c.input) - if c.assembled == "" { + if c.name == "" { assert.Error(t, err, c.input) } else { assert.NoError(t, err, c.input) @@ -59,7 +49,6 @@ func TestDecompose(t *testing.T) { assert.Equal(t, c.tag, parts.tag, c.input) assert.Equal(t, c.isTagged, parts.isTagged, c.input) assert.Equal(t, c.hasRegistry, parts.hasRegistry, c.input) - assert.Equal(t, c.assembled, parts.assemble(), c.input) } } } -- cgit v1.2.3-54-g00ecf