From 99d2259f8a71dbe5a0d9e78757b51551ce0eb8b1 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Wed, 9 Jan 2019 18:54:17 +0100 Subject: Simplify pullGoalFromPossiblyUnqualifiedName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After inlining assembleWithTransport, we have two branches with the same prepending of decomposedImage.transport; move that out of the branches. Should not change behavior. Signed-off-by: Miloslav Trmač --- libpod/image/pull.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libpod/image') diff --git a/libpod/image/pull.go b/libpod/image/pull.go index 82fe0fdd6..d09ddd599 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -286,11 +286,11 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG if decomposedImage.hasRegistry { var imageName, destName string if hasShaInInputName(inputName) { - imageName = fmt.Sprintf("%s%s", decomposedImage.transport, inputName) + imageName = inputName } else { - imageName = fmt.Sprintf("%s%s", decomposedImage.transport, decomposedImage.assemble()) + imageName = decomposedImage.assemble() } - srcRef, err := alltransports.ParseImageName(imageName) + srcRef, err := alltransports.ParseImageName(fmt.Sprintf("%s%s", decomposedImage.transport, imageName)) if err != nil { return nil, errors.Wrapf(err, "unable to parse '%s'", inputName) } @@ -318,11 +318,11 @@ func (ir *Runtime) pullGoalFromPossiblyUnqualifiedName(inputName string) (*pullG var refPairs []pullRefPair for _, registry := range searchRegistries { decomposedImage.registry = registry - imageName := fmt.Sprintf("%s%s", decomposedImage.transport, decomposedImage.assemble()) + imageName := decomposedImage.assemble() if hasShaInInputName(inputName) { - imageName = fmt.Sprintf("%s%s/%s", decomposedImage.transport, registry, inputName) + imageName = fmt.Sprintf("%s/%s", registry, inputName) } - srcRef, err := alltransports.ParseImageName(imageName) + srcRef, err := alltransports.ParseImageName(fmt.Sprintf("%s%s", decomposedImage.transport, imageName)) if err != nil { return nil, errors.Wrapf(err, "unable to parse '%s'", inputName) } -- cgit v1.2.3-54-g00ecf