From f07aa1bfdc558b8fc2739858ba89da245a21f9ac Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Mon, 19 Jun 2023 14:14:48 +0200 Subject: [PATCH] make lint: enable wastedassign Because we shouldn't waste assigns. Signed-off-by: Valentin Rothberg --- .golangci.yml | 1 - libpod/container_internal_common.go | 1 - libpod/container_internal_linux.go | 2 +- libpod/oci_conmon_common.go | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f72b12739b..f414aeb026 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,7 +21,6 @@ linters: # useful hints that should be addressed - ginkgolinter - nakedret - - wastedassign - gosmopolitan # usage of time.Local in pkg/k8s.io - tagliatelle # too many JSON keys cannot be changed due to compat - nosnakecase # too many false positives due to the `unix` package diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index d7cb65e43b..401a3986fc 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -2463,7 +2463,6 @@ func (c *Container) setHomeEnvIfNeeded() error { } // Ensure HOME is not already set in Env - home := "" for _, s := range c.config.Spec.Process.Env { if strings.HasPrefix(s, "HOME=") { return nil diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 0a4f99a24e..22efb94f76 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -750,7 +750,7 @@ func (c *Container) safeMountSubPath(mountPoint, subpath string) (s *safeMountIn if err != nil { return nil, err } - npath := "" + var npath string switch { case fi.Mode()&fs.ModeSymlink != 0: return nil, fmt.Errorf("file %q is a symlink", joinedPath) diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index 38fd07bdea..89a025b8f9 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -1488,7 +1488,7 @@ func readConmonPipeData(runtimeName string, pipe *os.File, ociLog string) (int, ch <- syncStruct{si: si} }() - data := -1 + var data int select { case ss := <-ch: if ss.err != nil {