Skip to content

errcheck: no option to skip default excludes #2606

Closed
@mislav

Description

@mislav

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

The upgrade of errcheck in #1319 resulted in a regression where there is no option to use the .golangci.yml config file to skip the default errcheck excludes.

The default errcheck excludes are imported in this line:

Symbols: append([]string{}, errcheck.DefaultExcludedSymbols...),

From this point onward, golangci config file can only append to the Symbols slice, but not remove from it. The errcheck standalone tool has an option to skip these excludes with its flag errcheck --excludeonly, but the golangci tool does not have an equivalent.

Expectation: linters-settings.errcheck.* options from the golangci config file should include a way to skip the default errcheck excludes, allowing errcheck to report all violations found instead of just a subset of them.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.42.1 built from (unknown, mod sum: "h1:nC4WyrbdnNdohDVUoNKjy/4N4FTM1gCFaVeXecy6vzM=") on (unknown)

Configuration file

$ cat .golangci.yml
issues:
  exclude-use-default: false

Go environment

$ go version && go env
go version go1.17 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mislav/Library/Caches/go-build"
GOENV="/Users/mislav/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/mislav/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mislav/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.17/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.17/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mislav/p/survey/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/83/1fmp_ys94j15w9q32g20d2kr0000gn/T/go-build3827898059=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

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

Code example or link to a public repository

n/a

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