diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-02-11 14:15:26 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-02-11 23:01:29 +0100 |
commit | ef2fc90f2d0057bfddee1b83d307e853181a4988 (patch) | |
tree | d1a8f350ff32068ea017e7a5c5384c8a184a8fb5 /libpod | |
parent | afe4ce6b1ce6a5ba21472f51defd243bdd7750b3 (diff) | |
download | podman-ef2fc90f2d0057bfddee1b83d307e853181a4988.tar.gz podman-ef2fc90f2d0057bfddee1b83d307e853181a4988.tar.bz2 podman-ef2fc90f2d0057bfddee1b83d307e853181a4988.zip |
Enable stylecheck linter
Use the stylecheck linter and fix the reported problems.
[NO TESTS NEEDED]
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/boltdb_state.go | 6 | ||||
-rw-r--r-- | libpod/container_exec.go | 2 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 6 | ||||
-rw-r--r-- | libpod/container_path_resolution.go | 8 |
4 files changed, 12 insertions, 10 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index b2ee63b08..df00a8851 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -269,9 +269,9 @@ func (s *BoltState) Refresh() error { if err != nil { return err } - for _, execId := range toRemove { - if err := ctrExecBkt.Delete([]byte(execId)); err != nil { - return errors.Wrapf(err, "error removing exec session %s from container %s", execId, string(id)) + for _, execID := range toRemove { + if err := ctrExecBkt.Delete([]byte(execID)); err != nil { + return errors.Wrapf(err, "error removing exec session %s from container %s", execID, string(id)) } } } diff --git a/libpod/container_exec.go b/libpod/container_exec.go index 5aee847e1..443d631db 100644 --- a/libpod/container_exec.go +++ b/libpod/container_exec.go @@ -78,9 +78,11 @@ type ExecConfig struct { type ExecSession struct { // Id is the ID of the exec session. // Named somewhat strangely to not conflict with ID(). + // nolint:stylecheck Id string `json:"id"` // ContainerId is the ID of the container this exec session belongs to. // Named somewhat strangely to not conflict with ContainerID(). + // nolint:stylecheck ContainerId string `json:"containerId"` // State is the state of the exec session. diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 1c4537a27..da8f07c9e 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -521,14 +521,14 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { }} } for _, gid := range execUser.Sgids { - isGidAvailable := false + isGIDAvailable := false for _, m := range gidMappings { if gid >= m.ContainerID && gid < m.ContainerID+m.Size { - isGidAvailable = true + isGIDAvailable = true break } } - if isGidAvailable { + if isGIDAvailable { g.AddProcessAdditionalGid(uint32(gid)) } else { logrus.Warnf("additional gid=%d is not present in the user namespace, skip setting it", gid) diff --git a/libpod/container_path_resolution.go b/libpod/container_path_resolution.go index 805b3b947..51e3844c8 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 |