diff options
author | Matej Vasek <mvasek@redhat.com> | 2020-11-04 22:03:53 +0100 |
---|---|---|
committer | Matej Vasek <mvasek@redhat.com> | 2020-11-19 20:31:47 +0100 |
commit | 430729a391824774dcf11d93e7211c5785eb17c0 (patch) | |
tree | 8be27b73264a0c4b18186c243c254893542f43c9 /pkg/api/handlers/compat | |
parent | 4e2d18db903e19c6cb56d75da0f69e42abe64c47 (diff) | |
download | podman-430729a391824774dcf11d93e7211c5785eb17c0.tar.gz podman-430729a391824774dcf11d93e7211c5785eb17c0.tar.bz2 podman-430729a391824774dcf11d93e7211c5785eb17c0.zip |
fix lint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r-- | pkg/api/handlers/compat/containers_archive.go | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go index f42a821cd..870e681de 100644 --- a/pkg/api/handlers/compat/containers_archive.go +++ b/pkg/api/handlers/compat/containers_archive.go @@ -5,6 +5,9 @@ import ( "encoding/base64" "encoding/json" "fmt" + "path/filepath" + "strings" + "github.com/containers/buildah/copier" "github.com/containers/buildah/pkg/chrootuser" "github.com/containers/podman/v2/libpod" @@ -12,15 +15,14 @@ import ( "github.com/containers/podman/v2/pkg/api/handlers/utils" "github.com/containers/storage/pkg/idtools" "github.com/opencontainers/runtime-spec/specs-go" - "path/filepath" - "strings" - "github.com/gorilla/schema" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" "net/http" "os" "time" + + "github.com/gorilla/schema" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) func Archive(w http.ResponseWriter, r *http.Request) { @@ -131,7 +133,6 @@ func handleHeadOrGet(w http.ResponseWriter, r *http.Request, decoder *schema.Dec } else { w.WriteHeader(http.StatusOK) } - } func handlePut(w http.ResponseWriter, r *http.Request, decoder *schema.Decoder, runtime *libpod.Runtime) { @@ -249,7 +250,6 @@ func getUser(mountPoint string, userspec string) (specs.User, error) { } else { u.AdditionalGids = groups } - } return u, err } @@ -270,10 +270,7 @@ func fixUpMountPointAndPath(runtime *libpod.Runtime, ctr *libpod.Container, moun mountPoint = newMountPoint ctrPath = path } else if isBindMount, mount := isBindMountDestName(ctrPath, ctr); isBindMount { //nolint(gocritic) - newMountPoint, path, err := pathWithBindMountSource(mount, ctrPath) - if err != nil { - return "", "", errors.Wrapf(err, "error getting source path from bind mount %s", mount.Destination) - } + newMountPoint, path := pathWithBindMountSource(mount, ctrPath) mountPoint = newMountPoint ctrPath = path } @@ -337,9 +334,9 @@ func matchVolumePath(path, target string) bool { return pathStr == target } -func pathWithBindMountSource(m specs.Mount, path string) (string, string, error) { +func pathWithBindMountSource(m specs.Mount, path string) (string, string) { if !filepath.IsAbs(path) { path = filepath.Join(string(os.PathSeparator), path) } - return m.Source, strings.TrimPrefix(path, m.Destination), nil + return m.Source, strings.TrimPrefix(path, m.Destination) } |