summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/boltdb_state.go9
-rw-r--r--libpod/container.go1
-rw-r--r--libpod/container_exec.go2
-rw-r--r--libpod/container_inspect.go1
-rw-r--r--libpod/container_internal.go2
-rw-r--r--libpod/container_internal_linux.go7
-rw-r--r--libpod/container_path_resolution.go10
-rw-r--r--libpod/events/events.go1
-rw-r--r--libpod/events/filters.go1
-rw-r--r--libpod/events/logfile.go1
-rw-r--r--libpod/healthcheck.go2
-rw-r--r--libpod/image/image.go1
-rw-r--r--libpod/image/image_test.go1
-rw-r--r--libpod/image/prune.go2
-rw-r--r--libpod/image/utils.go4
-rw-r--r--libpod/info.go6
-rw-r--r--libpod/network/create.go1
-rw-r--r--libpod/network/create_test.go1
-rw-r--r--libpod/network/netconflist_test.go1
-rw-r--r--libpod/networking_linux.go3
-rw-r--r--libpod/oci_conmon_linux.go2
-rw-r--r--libpod/oci_util.go1
-rw-r--r--libpod/options.go3
-rw-r--r--libpod/plugin/volume_api.go3
-rw-r--r--libpod/reset.go1
-rw-r--r--libpod/runtime.go5
-rw-r--r--libpod/runtime_ctr.go1
-rw-r--r--libpod/runtime_img.go3
-rw-r--r--libpod/runtime_img_test.go1
-rw-r--r--libpod/runtime_pod_infra_linux.go1
-rw-r--r--libpod/volume_internal_linux.go8
31 files changed, 25 insertions, 61 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index b2ee63b08..c9d214cd0 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))
}
}
}
@@ -904,7 +904,6 @@ func (s *BoltState) ContainerInUse(ctr *Container) ([]string, error) {
}
return depCtrs, nil
-
}
// AllContainers retrieves all the containers in the database
@@ -962,7 +961,6 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
}
return nil
-
})
})
if err != nil {
@@ -2580,7 +2578,6 @@ func (s *BoltState) LookupVolume(name string) (*Volume, error) {
}
return volume, nil
-
}
// HasVolume returns true if the given volume exists in the state, otherwise it returns false
diff --git a/libpod/container.go b/libpod/container.go
index e667cd991..613a02554 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1057,7 +1057,6 @@ func (c *Container) NetworkDisabled() (bool, error) {
return container.NetworkDisabled()
}
return networkDisabled(c)
-
}
func networkDisabled(c *Container) (bool, error) {
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index 5aee847e1..0d18b55ca 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,golint
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,golint
ContainerId string `json:"containerId"`
// State is the state of the exec session.
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index efe09af92..e87e26c61 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -796,7 +796,6 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
if c.config.UTSNsCtr != "" {
utsMode = fmt.Sprintf("container:%s", c.config.UTSNsCtr)
} else if ctrSpec.Linux != nil {
-
// Locate the spec's UTS namespace.
// If there is none, it's uts=host.
// If there is one and it has a path, it's "ns:".
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 9ea9e02cd..ced357096 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -266,7 +266,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err
c.newContainerEvent(events.Restart)
// Increment restart count
- c.state.RestartCount += 1
+ c.state.RestartCount++
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)
if err := c.save(); err != nil {
return false, err
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 1c4537a27..a3476f42e 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)
@@ -1614,7 +1614,6 @@ func (c *Container) makeBindMounts() error {
return errors.Wrapf(err, "error setting timezone for container %s", c.ID())
}
c.state.BindMounts["/etc/localtime"] = localtimePath
-
}
}
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)
}
diff --git a/libpod/events/events.go b/libpod/events/events.go
index aa0401b62..01ea6a386 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -97,7 +97,6 @@ func newEventFromJSONString(event string) (*Event, error) {
return nil, err
}
return &e, nil
-
}
// ToString converts a Type to a string
diff --git a/libpod/events/filters.go b/libpod/events/filters.go
index 62891d32c..26e1e10ba 100644
--- a/libpod/events/filters.go
+++ b/libpod/events/filters.go
@@ -86,7 +86,6 @@ func generateEventSinceOption(timeSince time.Time) func(e *Event) bool {
func generateEventUntilOption(timeUntil time.Time) func(e *Event) bool {
return func(e *Event) bool {
return e.Time.Before(timeUntil)
-
}
}
diff --git a/libpod/events/logfile.go b/libpod/events/logfile.go
index 05ae3ce52..c5feabe66 100644
--- a/libpod/events/logfile.go
+++ b/libpod/events/logfile.go
@@ -39,7 +39,6 @@ func (e EventLogFile) Write(ee Event) error {
return err
}
return nil
-
}
// Reads from the log file
diff --git a/libpod/healthcheck.go b/libpod/healthcheck.go
index f77075893..6c5becd5b 100644
--- a/libpod/healthcheck.go
+++ b/libpod/healthcheck.go
@@ -190,7 +190,7 @@ func (c *Container) updateHealthCheckLog(hcl define.HealthCheckLog, inStartPerio
}
if !inStartPeriod {
// increment failing streak
- healthCheck.FailingStreak += 1
+ healthCheck.FailingStreak++
// if failing streak > retries, then status to unhealthy
if healthCheck.FailingStreak >= c.HealthCheckConfig().Retries {
healthCheck.Status = define.HealthCheckUnhealthy
diff --git a/libpod/image/image.go b/libpod/image/image.go
index d732aecfe..8d8af0064 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -1688,7 +1688,6 @@ func (i *Image) GetConfigBlob(ctx context.Context) (*manifest.Schema2Image, erro
return nil, errors.Wrapf(err, "unable to parse image blob for %s", i.ID())
}
return &blob, nil
-
}
// GetHealthCheck returns a HealthConfig for an image. This function only works with
diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go
index 2704b8baf..8055ef7b1 100644
--- a/libpod/image/image_test.go
+++ b/libpod/image/image_test.go
@@ -66,7 +66,6 @@ func makeLocalMatrix(b, bg *Image) []localImageTest {
l = append(l, busybox, busyboxGlibc)
return l
-
}
func TestMain(m *testing.M) {
diff --git a/libpod/image/prune.go b/libpod/image/prune.go
index 587c99333..6f026f630 100644
--- a/libpod/image/prune.go
+++ b/libpod/image/prune.go
@@ -52,7 +52,6 @@ func generatePruneFilterFuncs(filter, filterValue string) (ImageFilter, error) {
}
return false
}, nil
-
}
return nil, nil
}
@@ -170,7 +169,6 @@ func (ir *Runtime) PruneImages(ctx context.Context, all bool, filter []string) (
Size: uint64(imgSize),
})
}
-
}
return preports, nil
}
diff --git a/libpod/image/utils.go b/libpod/image/utils.go
index 5e7fed5c6..8882adcc1 100644
--- a/libpod/image/utils.go
+++ b/libpod/image/utils.go
@@ -45,7 +45,6 @@ func findImageInRepotags(search imageParts, images []*Image) (*storage.Image, er
}
}
if len(candidates) == 0 {
-
return nil, errors.Wrapf(define.ErrNoSuchImage, "unable to find a name and tag match for %s in repotags", searchName)
}
@@ -75,9 +74,8 @@ func findImageInRepotags(search imageParts, images []*Image) (*storage.Image, er
}
if rwImageCnt > 1 {
return nil, errors.Wrapf(define.ErrMultipleImages, "found multiple read/write images %s", strings.Join(keys, ","))
- } else {
- return nil, errors.Wrapf(define.ErrMultipleImages, "found multiple read/only images %s", strings.Join(keys, ","))
}
+ return nil, errors.Wrapf(define.ErrMultipleImages, "found multiple read/only images %s", strings.Join(keys, ","))
}
return candidates[0].image.image, nil
}
diff --git a/libpod/info.go b/libpod/info.go
index 1b3550abd..f5bfb122e 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -222,11 +222,11 @@ func (r *Runtime) getContainerStoreInfo() (define.ContainerStore, error) {
}
switch state {
case define.ContainerStateRunning:
- running += 1
+ running++
case define.ContainerStatePaused:
- paused += 1
+ paused++
default:
- stopped += 1
+ stopped++
}
}
cs.Paused = paused
diff --git a/libpod/network/create.go b/libpod/network/create.go
index deacf487a..c58d62575 100644
--- a/libpod/network/create.go
+++ b/libpod/network/create.go
@@ -75,7 +75,6 @@ func validateBridgeOptions(options entities.NetworkCreateOptions) error {
}
return nil
-
}
// parseMTU parses the mtu option
diff --git a/libpod/network/create_test.go b/libpod/network/create_test.go
index 0b828e635..017bf31fe 100644
--- a/libpod/network/create_test.go
+++ b/libpod/network/create_test.go
@@ -8,7 +8,6 @@ import (
)
func Test_validateBridgeOptions(t *testing.T) {
-
tests := []struct {
name string
subnet net.IPNet
diff --git a/libpod/network/netconflist_test.go b/libpod/network/netconflist_test.go
index 5ff733f0f..161764ed9 100644
--- a/libpod/network/netconflist_test.go
+++ b/libpod/network/netconflist_test.go
@@ -7,7 +7,6 @@ import (
)
func TestNewIPAMDefaultRoute(t *testing.T) {
-
tests := []struct {
name string
isIPv6 bool
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 55d338e7d..de6f75d3e 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -480,9 +480,8 @@ func (r *Runtime) setupSlirp4netns(ctr *Container) error {
if havePortMapping {
if isSlirpHostForward {
return r.setupRootlessPortMappingViaSlirp(ctr, cmd, apiSocket)
- } else {
- return r.setupRootlessPortMappingViaRLK(ctr, netnsPath)
}
+ return r.setupRootlessPortMappingViaRLK(ctr, netnsPath)
}
return nil
}
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 23bfb29d7..38ffba7d2 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1228,7 +1228,6 @@ func prepareProcessExec(c *Container, options *ExecOptions, env []string, sessio
if options.Cwd != "" {
pspec.Cwd = options.Cwd
-
}
var addGroups []string
@@ -1798,5 +1797,4 @@ func httpAttachNonTerminalCopy(container *net.UnixConn, http *bufio.ReadWriter,
return err
}
}
-
}
diff --git a/libpod/oci_util.go b/libpod/oci_util.go
index d40cf13bd..4ec050d6d 100644
--- a/libpod/oci_util.go
+++ b/libpod/oci_util.go
@@ -103,7 +103,6 @@ func bindPorts(ports []ocicni.PortMapping) ([]*os.File, error) {
}
default:
return nil, fmt.Errorf("unknown protocol %s", i.Protocol)
-
}
}
return files, nil
diff --git a/libpod/options.go b/libpod/options.go
index 74ee60fef..8831f527e 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1109,7 +1109,6 @@ func WithLogTag(tag string) CtrCreateOption {
return nil
}
-
}
// WithCgroupsMode disables the creation of CGroups for the conmon process.
@@ -1131,7 +1130,6 @@ func WithCgroupsMode(mode string) CtrCreateOption {
return nil
}
-
}
// WithCgroupParent sets the Cgroup Parent of the new container.
@@ -1430,7 +1428,6 @@ func WithOverlayVolumes(volumes []*ContainerOverlayVolume) CtrCreateOption {
}
for _, vol := range volumes {
-
ctr.config.OverlayVolumes = append(ctr.config.OverlayVolumes, &ContainerOverlayVolume{
Dest: vol.Dest,
Source: vol.Source,
diff --git a/libpod/plugin/volume_api.go b/libpod/plugin/volume_api.go
index c5dec651c..79aebed43 100644
--- a/libpod/plugin/volume_api.go
+++ b/libpod/plugin/volume_api.go
@@ -241,9 +241,8 @@ func (p *VolumePlugin) makeErrorResponse(err, endpoint, volName string) error {
}
if volName != "" {
return errors.Wrapf(errors.New(err), "error on %s on volume %s in volume plugin %s", endpoint, volName, p.Name)
- } else {
- return errors.Wrapf(errors.New(err), "error on %s in volume plugin %s", endpoint, p.Name)
}
+ return errors.Wrapf(errors.New(err), "error on %s in volume plugin %s", endpoint, p.Name)
}
// Handle error responses from plugin
diff --git a/libpod/reset.go b/libpod/reset.go
index 24efeed40..3346f9d3f 100644
--- a/libpod/reset.go
+++ b/libpod/reset.go
@@ -16,7 +16,6 @@ import (
// Reset removes all storage
func (r *Runtime) Reset(ctx context.Context) error {
-
pods, err := r.GetAllPods()
if err != nil {
return err
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 1ad39fe2f..42af2046d 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -146,7 +146,6 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (*Runtime, error)
// An error will be returned if the configuration file at the given path does
// not exist or cannot be loaded
func NewRuntimeFromConfig(ctx context.Context, userConfig *config.Config, options ...RuntimeOption) (*Runtime, error) {
-
return newRuntimeFromConfig(ctx, userConfig, options...)
}
@@ -382,7 +381,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// Initialize remaining OCI runtimes
for name, paths := range runtime.config.Engine.OCIRuntimes {
-
ociRuntime, err := newConmonOCIRuntime(name, paths, runtime.conmonPath, runtime.runtimeFlags, runtime.config)
if err != nil {
// Don't fatally error.
@@ -437,7 +435,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// Set up the CNI net plugin
if !rootless.IsRootless() {
-
netPlugin, err := ocicni.InitCNI(runtime.config.Network.DefaultNetwork, runtime.config.Network.NetworkConfigDir, runtime.config.Network.CNIPluginDirs...)
if err != nil {
return errors.Wrapf(err, "error configuring CNI network plugin")
@@ -484,7 +481,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
if became {
os.Exit(ret)
}
-
}
// If the file doesn't exist, we need to refresh the state
// This will trigger on first use as well, but refreshing an
@@ -787,7 +783,6 @@ type DBConfig struct {
// mergeDBConfig merges the configuration from the database.
func (r *Runtime) mergeDBConfig(dbConfig *DBConfig) {
-
c := &r.config.Engine
if !r.storageSet.RunRootSet && dbConfig.StorageTmp != "" {
if r.storageConfig.RunRoot != dbConfig.StorageTmp &&
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 49cf42626..1b3532f1f 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -1139,7 +1139,6 @@ func (r *Runtime) IsStorageContainerMounted(id string) (bool, string, error) {
// StorageContainers returns a list of containers from containers/storage that
// are not currently known to Podman.
func (r *Runtime) StorageContainers() ([]storage.Container, error) {
-
if r.store == nil {
return nil, define.ErrStoreNotInitialized
}
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 2c5442bd2..f56fa8cce 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -313,9 +313,8 @@ func (r *Runtime) LoadImageFromSingleImageArchive(ctx context.Context, writer io
if err == nil && src != nil {
if newImages, err := r.ImageRuntime().LoadFromArchiveReference(ctx, src, signaturePolicy, writer); err == nil {
return getImageNames(newImages), nil
- } else {
- saveErr = err
}
+ saveErr = err
}
}
return "", errors.Wrapf(saveErr, "error pulling image")
diff --git a/libpod/runtime_img_test.go b/libpod/runtime_img_test.go
index 6ca4d900b..40d5860cf 100644
--- a/libpod/runtime_img_test.go
+++ b/libpod/runtime_img_test.go
@@ -26,7 +26,6 @@ func createTmpFile(content []byte) (string, error) {
if _, err := tmpfile.Write(content); err != nil {
return "", err
-
}
if err := tmpfile.Close(); err != nil {
return "", err
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index 564851f4e..bc37bdb23 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -24,7 +24,6 @@ const (
)
func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, rawImageName, imgID string, config *v1.ImageConfig) (*Container, error) {
-
// Set up generator for infra container defaults
g, err := generate.New("linux")
if err != nil {
diff --git a/libpod/volume_internal_linux.go b/libpod/volume_internal_linux.go
index e184505e7..82c01be44 100644
--- a/libpod/volume_internal_linux.go
+++ b/libpod/volume_internal_linux.go
@@ -45,7 +45,7 @@ func (v *Volume) mount() error {
// If the count is non-zero, the volume is already mounted.
// Nothing to do.
if v.state.MountCount > 0 {
- v.state.MountCount += 1
+ v.state.MountCount++
logrus.Debugf("Volume %s mount count now at %d", v.Name(), v.state.MountCount)
return v.save()
}
@@ -67,7 +67,7 @@ func (v *Volume) mount() error {
return err
}
- v.state.MountCount += 1
+ v.state.MountCount++
v.state.MountPoint = mountPoint
return v.save()
}
@@ -109,7 +109,7 @@ func (v *Volume) mount() error {
logrus.Debugf("Mounted volume %s", v.Name())
// Increment the mount counter
- v.state.MountCount += 1
+ v.state.MountCount++
logrus.Debugf("Volume %s mount count now at %d", v.Name(), v.state.MountCount)
return v.save()
}
@@ -152,7 +152,7 @@ func (v *Volume) unmount(force bool) error {
}
if !force {
- v.state.MountCount -= 1
+ v.state.MountCount--
} else {
v.state.MountCount = 0
}