Skip to content

"Error return value is not checked" errors appear on v1.57.0 of golangci-lint but disappear on newer versions #4869

Closed
@jonathan-innis

Description

@jonathan-innis

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

Description of the problem

When I run v1.57.0 of golangci-lint, I see the following error output for my code

karpenter-provider-aws git:(main) ✗ golangci-lint run
pkg/controllers/nodeclass/status/ami_test.go:312:30: Error return value is not checked (errcheck)
                ExpectObjectReconcileFailed(ctx, env.Client, statusController, nodeClass)

When I run the next minor version (v1.58.0), I don't see any errors for the same code -- though the configuration didn't change and it appears there were no updates to the errcheck linter in the v1.58.0 version. I'm questioning why golangci-lint seems to be missing these linting errors on the newer versions.

Version of golangci-lint

$ golangci-lint --version

golangci-lint has version v1.57.0 built with go1.22.5 from (unknown, modified: ?, mod sum: "h1:wDlrnpFzqh16IqVuaDxUK7WBzkGgtbvXd4EpqUBnhCI=") on (unknown)

Configuration

# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
run:
  tests: true
  timeout: 5m
linters:
  enable:
    - asciicheck
    - bidichk
    - errorlint
    - exportloopref
    - gosec
    - revive
    - stylecheck
    - tparallel
    - unconvert
    - unparam
    - gocyclo
    - govet
    - goimports
    - goheader
    - misspell
    - nilerr
  disable:
    - prealloc
linters-settings:
  gocyclo:
    min-complexity: 11
  govet:
    enable-all: true
    disable:
      - fieldalignment
  revive:
    rules:
    - name: dot-imports
      disabled: true
  stylecheck:
    dot-import-whitelist:
      - "github.com/onsi/ginkgo/v2"
      - "github.com/onsi/gomega"
  misspell:
    locale: US
    ignore-words: []
  goimports:
    local-prefixes: github.com/aws/karpenter-provider-aws
  goheader:
    template: |-
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
      
          http://www.apache.org/licenses/LICENSE-2.0
      
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
issues:
  fix: true
  exclude: ['declaration of "(err|ctx)" shadows declaration at']
  exclude-dirs:
    - tools
    - website
    - hack
    - charts
    - designs
  exclude-rules:
  - linters:
    - goheader
    path: 'zz_(.+)\.go' 

Go environment

$ go version && go env

go version go1.22.5 darwin/arm64
GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/joinnis/Library/Caches/go-build'
GOENV='/Users/joinnis/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/joinnis/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/joinnis/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/Users/joinnis/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.darwin-arm64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/joinnis/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.darwin-arm64/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/joinnis/github/karpenter-provider-aws/go.mod'
GOWORK='/Users/joinnis/github/karpenter-provider-aws/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/dt/p6bcmvf11cl4lfj4dwjzcg140000gr/T/go-build3315182642=/tmp/go-build -gno-record-gcc-switches -fno-common'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v

INFO [config_reader] Config search paths: [./ /Users/joinnis/github/karpenter-provider-aws /Users/joinnis/github /Users/joinnis /Users /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 21 linters: [asciicheck bidichk errcheck errorlint exportloopref gocyclo goheader goimports gosec gosimple govet ineffassign misspell nilerr revive staticcheck stylecheck tparallel unconvert unparam unused] 
INFO [loader] Go packages loading at mode 575 (imports|types_sizes|compiled_files|deps|exports_file|files|name) took 5.533135125s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 31.472875ms 
INFO [linters_context/goanalysis] analyzers took 47m5.57695783s with top 10 stages: buildir: 16m59.766929796s, bidichk: 3m18.799071878s, goheader: 2m36.749766916s, buildssa: 2m12.706232999s, nilness: 1m8.033477125s, unparam: 1m7.002333078s, fact_deprecated: 41.99438032s, goimports: 36.611821294s, ctrlflow: 33.289062047s, printf: 32.158803307s 
INFO [runner] fixer took 0s with no stages        
INFO [runner/skip_dirs] Skipped 5 issues from dir hack/code/vpc_limits_gen by pattern hack 
INFO [runner/skip_dirs] Skipped 4 issues from dir hack/code/bandwidth_gen by pattern hack 
INFO [runner/skip_dirs] Skipped 9 issues from dir hack/code/prices_gen by pattern hack 
INFO [runner/skip_dirs] Skipped 4 issues from dir hack/code/instancetype_testdata_gen by pattern hack 
INFO [runner/skip_dirs] Skipped 212 issues from dir hack/docs by pattern hack 
INFO [runner] Issues before processing: 399, after processing: 1 
INFO [runner] Processors filtering stat (out/in): exclude: 151/156, source_code: 1/1, severity-rules: 1/1, invalid_issue: 399/399, skip_files: 399/399, identifier_marker: 156/156, max_from_linter: 1/1, path_shortener: 1/1, fixer: 1/1, sort_results: 1/1, skip_dirs: 165/399, nolint: 1/12, max_same_issues: 1/1, exclude-rules: 12/151, diff: 1/1, max_per_file_from_linter: 1/1, path_prefixer: 1/1, cgo: 399/399, filename_unadjuster: 399/399, autogenerated_exclude: 156/165, path_prettifier: 399/399, uniq_by_line: 1/1 
INFO [runner] processing took 120.753711ms with stages: autogenerated_exclude: 89.002833ms, nolint: 12.674083ms, identifier_marker: 6.515167ms, path_prettifier: 5.68925ms, exclude-rules: 4.782667ms, skip_dirs: 1.038126ms, exclude: 757.626µs, source_code: 98.792µs, fixer: 51.834µs, cgo: 46.959µs, invalid_issue: 44.416µs, filename_unadjuster: 34.501µs, max_from_linter: 11.125µs, max_same_issues: 2.167µs, uniq_by_line: 1.666µs, path_shortener: 709ns, diff: 667ns, max_per_file_from_linter: 292ns, sort_results: 249ns, severity-rules: 249ns, skip_files: 167ns, path_prefixer: 166ns 
INFO [runner] linters took 2m39.412972875s with stages: goanalysis_metalinter: 2m39.291495875s 
pkg/controllers/nodeclass/status/ami_test.go:312:30: Error return value is not checked (errcheck)
                ExpectObjectReconcileFailed(ctx, env.Client, statusController, nodeClass)
                                           ^
INFO File cache stats: 203 entries of total size 1.9MiB 
INFO Memory: 1133 samples, avg is 2521.6MB, max is 4178.9MB 
INFO Execution took 2m45.014005958s

A minimal reproducible example or link to a public repository

https://github.com/aws/karpenter-provider-aws

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions