From 0d4a5549d65ee390f59169b3efef2f0e6c108618 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 28 Jul 2018 04:12:21 +0200 Subject: RFC: Remove unused transport name constants from libpod MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are not used anywhere in the packagee. Two of the values still have users in the CLI, but used only once. So, use the .Transport.Name() calls in there directly, that is likely to be cheaper (and makes the files depend directly on the transports instead of referring to them indirectly through libpod). RFC: Should not change behavior in _this_ repo, but it is an externally-observable API change. Is there any user that could notice? Signed-off-by: Miloslav Trmač Closes: #1176 Approved by: rhatdan --- cmd/podman/pull.go | 4 ++-- cmd/podman/push.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 90fb1345a..a1d685735 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -6,11 +6,11 @@ import ( "os" "strings" + dockerarchive "github.com/containers/image/docker/archive" "github.com/containers/image/transports/alltransports" "github.com/containers/image/types" "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" image2 "github.com/projectatomic/libpod/libpod/image" "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" @@ -112,7 +112,7 @@ func pullCmd(c *cli.Context) error { } // Possible for docker-archive to have multiple tags, so use LoadFromArchiveReference instead - if strings.HasPrefix(image, libpod.DockerArchive+":") { + if strings.HasPrefix(image, dockerarchive.Transport.Name()+":") { srcRef, err := alltransports.ParseImageName(image) if err != nil { return errors.Wrapf(err, "error parsing %q", image) diff --git a/cmd/podman/push.go b/cmd/podman/push.go index 4a0286ae8..3c2e59e58 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -6,12 +6,12 @@ import ( "os" "strings" + "github.com/containers/image/directory" "github.com/containers/image/manifest" "github.com/containers/image/types" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/image" "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" @@ -101,7 +101,7 @@ func pushCmd(c *cli.Context) error { // --compress and --format can only be used for the "dir" transport splitArg := strings.SplitN(destName, ":", 2) if c.IsSet("compress") || c.IsSet("format") { - if splitArg[0] != libpod.DirTransport { + if splitArg[0] != directory.Transport.Name() { return errors.Errorf("--compress and --format can be set only when pushing to a directory using the 'dir' transport") } } -- cgit v1.2.3-54-g00ecf