diff --git a/.golangci.yml b/.golangci.yml index 3a93825f98d0..1ae3313242d7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,6 +19,7 @@ linters: - gofmt # Checks whether code was gofmt-ed - goheader # Checks is file headers matche a given pattern - intrange # Checking for loops that could use an integer range + - nilnesserr # Reports constructs that check for err != nil but return a different nil value error - nolintlint # Find ill-formed or insufficiently explained nolint directives - nosprintfhostport # Detects misuses of Sprintf to construct hosts with ports in a URL - perfsprint # Checks for faster fmt.Sprintf alternatives diff --git a/pkg/token/joindecode.go b/pkg/token/joindecode.go index c6b420ab5291..b37dccb1f873 100644 --- a/pkg/token/joindecode.go +++ b/pkg/token/joindecode.go @@ -39,12 +39,12 @@ func DecodeJoinToken(token string) ([]byte, error) { var buf bytes.Buffer _, err = io.Copy(&buf, gz) - gzErr := gz.Close() + closeErr := gz.Close() if err != nil { return nil, err } - if gzErr != nil { - return nil, err + if closeErr != nil { + return nil, closeErr } return buf.Bytes(), nil