summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-01-13 13:01:45 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-01-13 14:27:02 +0100
commit67165b76753f65b6f58d471f314678ae12a4c722 (patch)
tree72580ee08e5d9d2e57b97a7293deaf8a2a0f2e67 /libpod/container_internal.go
parent270d892c3d77de4fd8e6341193175c0572fb5f99 (diff)
downloadpodman-67165b76753f65b6f58d471f314678ae12a4c722.tar.gz
podman-67165b76753f65b6f58d471f314678ae12a4c722.tar.bz2
podman-67165b76753f65b6f58d471f314678ae12a4c722.zip
make lint: enable gocritic
`gocritic` is a powerful linter that helps in preventing certain kinds of errors as well as enforcing a coding style. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 46c83149a..0e883588c 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -22,7 +22,7 @@ import (
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/mount"
- "github.com/cyphar/filepath-securejoin"
+ securejoin "github.com/cyphar/filepath-securejoin"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
"github.com/opencontainers/selinux/go-selinux/label"
@@ -339,7 +339,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (restarted bool, er
c.newContainerEvent(events.Restart)
// Increment restart count
- c.state.RestartCount = c.state.RestartCount + 1
+ c.state.RestartCount += 1
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)
if err := c.save(); err != nil {
return false, err
@@ -1286,7 +1286,7 @@ func (c *Container) restartWithTimeout(ctx context.Context, timeout uint) (err e
// TODO: Add ability to override mount label so we can use this for Mount() too
// TODO: Can we use this for export? Copying SHM into the export might not be
// good
-func (c *Container) mountStorage() (_ string, Err error) {
+func (c *Container) mountStorage() (_ string, deferredErr error) {
var err error
// Container already mounted, nothing to do
if c.state.Mounted {
@@ -1307,7 +1307,7 @@ func (c *Container) mountStorage() (_ string, Err error) {
return "", errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
}
defer func() {
- if Err != nil {
+ if deferredErr != nil {
if err := c.unmountSHM(c.config.ShmDir); err != nil {
logrus.Errorf("Error unmounting SHM for container %s after mount error: %v", c.ID(), err)
}
@@ -1324,7 +1324,7 @@ func (c *Container) mountStorage() (_ string, Err error) {
return "", err
}
defer func() {
- if Err != nil {
+ if deferredErr != nil {
if err := c.unmount(false); err != nil {
logrus.Errorf("Error unmounting container %s after mount error: %v", c.ID(), err)
}
@@ -1339,7 +1339,7 @@ func (c *Container) mountStorage() (_ string, Err error) {
return "", err
}
defer func() {
- if Err == nil {
+ if deferredErr == nil {
return
}
vol.lock.Lock()