From 86fb1bf8eb311551626e5877938a7d9d5aee6dac Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 28 Jul 2018 04:22:58 +0200 Subject: Remove an unnecessary use of alltransports.ParseImageName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the string is formatted including a constant transport name, just call the transport to create or parse a reference explicitly. This avoids unnecessary string formatting and parsing. Then drop image.TarballTransport, which has no remaining users. Should not change behavior (but does not add unit tests). Signed-off-by: Miloslav Trmač Closes: #1176 Approved by: rhatdan --- libpod/image/image.go | 3 +-- libpod/image/pull.go | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/libpod/image/image.go b/libpod/image/image.go index 068e57477..0c070154f 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -878,8 +878,7 @@ func (i *Image) Inspect(ctx context.Context) (*inspect.ImageData, error) { // Import imports and image into the store and returns an image func (ir *Runtime) Import(ctx context.Context, path, reference string, writer io.Writer, signingOptions SigningOptions, imageConfig ociv1.Image) (*Image, error) { - file := TarballTransport + ":" + path - src, err := alltransports.ParseImageName(file) + src, err := tarball.Transport.ParseReference(path) if err != nil { return nil, errors.Wrapf(err, "error parsing image name %q", path) } diff --git a/libpod/image/pull.go b/libpod/image/pull.go index 43d1ab837..060bab82a 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -15,7 +15,6 @@ import ( ociarchive "github.com/containers/image/oci/archive" "github.com/containers/image/pkg/sysregistries" is "github.com/containers/image/storage" - "github.com/containers/image/tarball" "github.com/containers/image/transports" "github.com/containers/image/transports/alltransports" "github.com/containers/image/types" @@ -35,9 +34,6 @@ var ( // DirTransport is the transport for pushing and pulling // images to and from a directory DirTransport = directory.Transport.Name() - // TarballTransport is the transport for importing a tar archive - // and creating a filesystem image - TarballTransport = tarball.Transport.Name() // DockerTransport is the transport for docker registries DockerTransport = docker.Transport.Name() // AtomicTransport is the transport for atomic registries -- cgit v1.2.3-54-g00ecf