diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-02-11 22:28:35 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-02-11 23:01:49 +0100 |
commit | 69ab67bf90aa4bbd285f360e3bca4c85b6028908 (patch) | |
tree | 3ab90163357d9d85aedae6555934ae5744b4ac83 /libpod | |
parent | ef2fc90f2d0057bfddee1b83d307e853181a4988 (diff) | |
download | podman-69ab67bf90aa4bbd285f360e3bca4c85b6028908.tar.gz podman-69ab67bf90aa4bbd285f360e3bca4c85b6028908.tar.bz2 podman-69ab67bf90aa4bbd285f360e3bca4c85b6028908.zip |
Enable golint linter
Use the golint 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/container_exec.go | 4 | ||||
-rw-r--r-- | libpod/container_internal.go | 2 | ||||
-rw-r--r-- | libpod/healthcheck.go | 2 | ||||
-rw-r--r-- | libpod/image/utils.go | 3 | ||||
-rw-r--r-- | libpod/info.go | 6 | ||||
-rw-r--r-- | libpod/networking_linux.go | 3 | ||||
-rw-r--r-- | libpod/plugin/volume_api.go | 3 | ||||
-rw-r--r-- | libpod/runtime_img.go | 3 | ||||
-rw-r--r-- | libpod/volume_internal_linux.go | 8 |
9 files changed, 15 insertions, 19 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go index 443d631db..0d18b55ca 100644 --- a/libpod/container_exec.go +++ b/libpod/container_exec.go @@ -78,11 +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 + // 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 + // nolint:stylecheck,golint ContainerId string `json:"containerId"` // State is the state of the exec session. 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/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/utils.go b/libpod/image/utils.go index 5e7fed5c6..6cc613b28 100644 --- a/libpod/image/utils.go +++ b/libpod/image/utils.go @@ -75,9 +75,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/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/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/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/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 } |