diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-22 13:13:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-22 13:13:50 +0200 |
commit | 3b52e4d0b5baacf5f63516c664a117a7537a075e (patch) | |
tree | ef6dc8150136e7941daf45a2e6b615dee43c7893 /pkg/adapter/containers.go | |
parent | d6b41eb393c154eaff79b4fdcb04c7510a6fdb20 (diff) | |
parent | db826d5d75630cca784bd7092eba5b06601ae27f (diff) | |
download | podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.tar.gz podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.tar.bz2 podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.zip |
Merge pull request #3562 from baude/golangcilint3
golangci-lint round #3
Diffstat (limited to 'pkg/adapter/containers.go')
-rw-r--r-- | pkg/adapter/containers.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index 7e2384e18..9726b237f 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -69,7 +69,7 @@ func (r *LocalRuntime) LookupContainer(idOrName string) (*Container, error) { func (r *LocalRuntime) StopContainers(ctx context.Context, cli *cliconfig.StopValues) ([]string, map[string]error, error) { var timeout *uint if cli.Flags().Changed("timeout") || cli.Flags().Changed("time") { - t := uint(cli.Timeout) + t := cli.Timeout timeout = &t } @@ -342,7 +342,7 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode if err := ctr.Start(ctx, c.IsSet("pod")); err != nil { // This means the command did not exist exitCode = 127 - if strings.Index(err.Error(), "permission denied") > -1 { + if strings.Contains(err.Error(), "permission denied") { exitCode = 126 } return exitCode, err @@ -405,7 +405,7 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode } // This means the command did not exist exitCode = 127 - if strings.Index(err.Error(), "permission denied") > -1 { + if strings.Contains(err.Error(), "permission denied") { exitCode = 126 } if c.IsSet("rm") { @@ -1057,7 +1057,7 @@ func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (stri } timeout := int(ctr.StopTimeout()) if c.StopTimeout >= 0 { - timeout = int(c.StopTimeout) + timeout = c.StopTimeout } name := ctr.ID() if c.Name { @@ -1153,9 +1153,7 @@ func (r *LocalRuntime) Exec(c *cliconfig.ExecValues, cmd []string) error { for _, e := range entries { i, err := strconv.Atoi(e.Name()) if err != nil { - if err != nil { - return errors.Wrapf(err, "cannot parse %s in /proc/self/fd", e.Name()) - } + return errors.Wrapf(err, "cannot parse %s in /proc/self/fd", e.Name()) } m[i] = true } |