summaryrefslogtreecommitdiff
path: root/libpod/container_path_resolution.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-12 11:30:00 -0500
committerGitHub <noreply@github.com>2021-02-12 11:30:00 -0500
commit291f59600b7857bbec6f340d3ceec6e2e9ce923f (patch)
tree401aaa4e56cbe585582fa1124a9cd77a83ae21a9 /libpod/container_path_resolution.go
parent1b284a298c0bde20561321f325d4a7ad00e7bd25 (diff)
parent78c8a87362ee27ba1d2a62b7c9d73adc313c7d7e (diff)
downloadpodman-291f59600b7857bbec6f340d3ceec6e2e9ce923f.tar.gz
podman-291f59600b7857bbec6f340d3ceec6e2e9ce923f.tar.bz2
podman-291f59600b7857bbec6f340d3ceec6e2e9ce923f.zip
Merge pull request #9331 from Luap99/lint
Enable more golangci-lint linters
Diffstat (limited to 'libpod/container_path_resolution.go')
-rw-r--r--libpod/container_path_resolution.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/libpod/container_path_resolution.go b/libpod/container_path_resolution.go
index 805b3b947..5245314ae 100644
--- a/libpod/container_path_resolution.go
+++ b/libpod/container_path_resolution.go
@@ -18,7 +18,7 @@ import (
// mountPoint (e.g., via a mount or volume), the resolved root (e.g., container
// mount, bind mount or volume) and the resolved path on the root (absolute to
// the host).
-func (container *Container) resolvePath(mountPoint string, containerPath string) (string, string, error) {
+func (c *Container) resolvePath(mountPoint string, containerPath string) (string, string, error) {
// Let's first make sure we have a path relative to the mount point.
pathRelativeToContainerMountPoint := containerPath
if !filepath.IsAbs(containerPath) {
@@ -26,7 +26,7 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
// container's working dir. To be extra careful, let's first
// join the working dir with "/", and the add the containerPath
// to it.
- pathRelativeToContainerMountPoint = filepath.Join(filepath.Join("/", container.WorkingDir()), containerPath)
+ pathRelativeToContainerMountPoint = filepath.Join(filepath.Join("/", c.WorkingDir()), containerPath)
}
resolvedPathOnTheContainerMountPoint := filepath.Join(mountPoint, pathRelativeToContainerMountPoint)
pathRelativeToContainerMountPoint = strings.TrimPrefix(pathRelativeToContainerMountPoint, mountPoint)
@@ -43,7 +43,7 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
searchPath := pathRelativeToContainerMountPoint
for {
- volume, err := findVolume(container, searchPath)
+ volume, err := findVolume(c, searchPath)
if err != nil {
return "", "", err
}
@@ -74,7 +74,7 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
return mountPoint, absolutePathOnTheVolumeMount, nil
}
- if mount := findBindMount(container, searchPath); mount != nil {
+ if mount := findBindMount(c, searchPath); mount != nil {
logrus.Debugf("Container path %q resolved to bind mount %q:%q on path %q", containerPath, mount.Source, mount.Destination, searchPath)
// We found a matching bind mount for searchPath. We
// now need to first find the relative path of our
@@ -86,14 +86,12 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
return "", "", err
}
return mount.Source, absolutePathOnTheBindMount, nil
-
}
if searchPath == "/" {
// Cannot go beyond "/", so we're done.
break
}
-
// Walk *down* the path (e.g., "/foo/bar/x" -> "/foo/bar").
searchPath = filepath.Dir(searchPath)
}