Closed
Description
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 read the typecheck section of the FAQ (https://golangci-lint.run/usage/faq/#why-do-you-have-typecheck-errors).
- Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)
Description of the problem
Hi.
It seems like that presence of some invalid code in thrid_party breaks the golangci-lint (see reproducer below).
Would it be possible to change the behavior of skip_dirs to not even look at those dirs?
Version of golangci-lint
golangci-lint --version
golangci-lint has version v1.54.2 built with go1.21.0 from (unknown, mod sum: "h1:oR9zxfWYxt7hFqk6+fw6Enr+E7F0SN2nqHhJYyIb0yo=") on (unknown)
Configuration
Fails even with empty config.
Go environment
$ go version && go env
go version go1.21.0 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/abozhenko/.cache/go-build'
GOENV='/home/abozhenko/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/abozhenko/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/abozhenko/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/abozhenko/reproducer/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1925773406=/tmp/go-build -gno-record-gcc-switches'
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/abozhenko/reproducer /home/abozhenko /home /]
INFO [lintersdb] Active 6 linters: [errcheck gosimple govet ineffassign staticcheck unused]
INFO [loader] Go packages loading at mode 575 (types_sizes|exports_file|imports|files|name|compiled_files|deps) took 92.790205ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 139.655µs
ERRO [linters_context] typechecking error: C++ source files not allowed when not using cgo or SWIG: build_test.cc
INFO [linters_context/goanalysis] analyzers took 1.903543341s with top 10 stages: buildir: 1.167198861s, ctrlflow: 107.034199ms, fact_deprecated: 99.824768ms, printf: 98.27748ms, fact_purity: 96.808395ms, SA5012: 88.347249ms, nilness: 88.166993ms, typedness: 79.023279ms, inspect: 76.311676ms, directives: 124.947µs
WARN [runner] Can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for "github.com/cncf/xds/go/udpa/data/orca/v1"
INFO [runner] processing took 3.388µs with stages: nolint: 617ns, max_same_issues: 360ns, skip_dirs: 359ns, exclude: 217ns, severity-rules: 205ns, cgo: 181ns, autogenerated_exclude: 156ns, path_prettifier: 134ns, max_from_linter: 134ns, filename_unadjuster: 132ns, identifier_marker: 130ns, source_code: 126ns, exclude-rules: 124ns, skip_files: 114ns, fixer: 114ns, path_prefixer: 49ns, path_shortener: 49ns, uniq_by_line: 48ns, sort_results: 47ns, diff: 46ns, max_per_file_from_linter: 46ns
INFO [runner] linters took 1.162426691s with stages: goanalysis_metalinter: 1.162384212s
ERRO Running error: 1 error occurred:
* can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for "github.com/cncf/xds/go/udpa/data/orca/v1"
INFO Memory: 14 samples, avg is 168.0MB, max is 241.5MB
INFO Execution took 1.260500811s
A minimal reproducible example or link to a public repository
mkdir reproducer
cd reproducer/
mkdir third_party
git clone https://github.com/cncf/xds third_party/
go mod init reproducer
golangci-lint run
Validation
- Yes, I've included all information above (version, config, etc.).