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 included all information below (version, config, etc.).
- 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
golangci-lint run
starts having the panic error shown below after this commit: SOF3/kelemetry@ca058d3 (the issue is reproduced with and without explicitly setting run.go
to 1.20)
Version of golangci-lint
$ golangci-lint version
$ golangci-lint version
golangci-lint has version 1.53.3 built with go1.20.5 from 2dcd82f3 on 2023-06-15T10:50:11Z
Configuration file
$ cat .golangci.yml
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exportloopref
- forbidigo
- gci
- gocheckcompilerdirectives
- goconst
- gofumpt
- goheader
# - gomnd # TODO
- goprintffuncname
- gosec
- grouper
- importas
- interfacebloat
- lll
- maintidx
- makezero
- misspell
- nakedret
- nilerr
- nosprintfhostport
- prealloc
- predeclared
- reassign
- revive
- tenv
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
- whitespace
# - wrapcheck # TODO
issues:
exclude-rules:
- path: pkg/util/errors
linters: [errorlint]
- path: cmd/kelemetry/pprof.go
linters: [gosec]
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/kubewharf/kelemetry)
goheader:
template: |-
Copyright {{ YEAR }} The Kelemetry Authors.
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.
gomnd:
ignored-numbers: ["2", "200", "300", "400", "500"]
ignored-files:
- 'pkg/jaeger/tf/config/default/default\.go'
ignored-functions:
- 'ctx.AbortWithError'
- '.*Var'
- 'os.OpenFile'
gosec:
excludes:
- G404 # not all code are security-sensitive
importas:
no-unaliased: true
alias:
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: k8serrors
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/api/(?P<group>[\w\d]+)/(?P<v1>v\d+)((?P<v2>\w)\w+(?P<v3>\d+))?
alias: ${group}${v1}${v2}${v3}
- pkg: k8s.io/apiserver/pkg/apis/audit/v1
alias: auditv1
- pkg: k8s.io/client-go/kubernetes/typed/(?P<group>[\w\d]+)/(?P<v1>v\d+)((?P<v2>\w)\w+(?P<v3>\d+))?
alias: ${group}${v1}${v2}${v3}client
- pkg: k8s.io/client-go/informers/(?P<group>[\w\d]+)/(?P<v1>v\d+)((?P<v2>\w)\w+(?P<v3>\d+))?
alias: ${group}${v1}${v2}${v3}informers
- pkg: k8s.io/client-go/listers/(?P<group>[\w\d]+)/(?P<v1>v\d+)((?P<v2>\w)\w+(?P<v3>\d+))?
alias: ${group}${v1}${v2}${v3}listers
lll:
line-length: 140
tab-width: 4
nakedret:
max-func-lines: 1
revive:
rules:
- name: var-naming
disabled: true
Go environment
$ go version
go version go1.20.3 linux/amd64
go env
not relevant, reproduced on actions/setup-go default setup.
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /data00/home/chankyin/go/src/github.com/kubewharf/kelemetry /data00/home/chankyin/go/src/github.com/kubewharf /data00/home/chankyin/go/src/github.com /data00/home/chankyin/go/src /data00/home/chankyin/go /data00/home/chankyin /data00/home /data00 / /home/chankyin]
INFO [config_reader] Used config file .golangci.yaml
INFO [lintersdb] Active 54 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck decorder dogsled dupl dupword durationcheck errcheck errchkjson errname errorlint execinquery exhaustive exportloopref forbidigo gci gocheckcompilerdirectives goconst gofumpt goheader goprintffuncname gosec gosimple govet grouper importas ineffassign interfacebloat lll maintidx makezero misspell nakedret nilerr nosprintfhostport prealloc predeclared reassign revive staticcheck tenv testpackage thelper tparallel typecheck unconvert unparam unused usestdlibvars whitespace]
INFO [loader] Go packages loading at mode 575 (deps|exports_file|compiled_files|files|imports|name|types_sizes) took 2.975318319s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 10.480317ms
INFO Memory: 433 samples, avg is 1324.4MB, max is 2280.2MB
INFO Execution took 1m0.581650156s
INFO [linters_context/goanalysis] analyzers took 19m45.479093517s with top 10 stages: buildir: 9m8.645799097s, buildssa: 7m31.085549468s, nilness: 15.756193982s, exhaustive: 12.247307631s, dupl: 10.032241294s, inspect: 9.967798701s, fact_deprecated: 8.347153774s, printf: 7.572203904s, unconvert: 7.544369526s, ctrlflow: 7.496679417s
ERRO [runner] Panic: unused: package "globalinformer" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: types.Object is nil, not *types.Func: goroutine 42553 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:109 +0x285
panic({0x10069a0, 0xc0bcced320})
runtime/panic.go:884 +0x213
golang.org/x/exp/typeparams.OriginMethod(0xc05b31a120)
golang.org/x/exp/[email protected]/common.go:112 +0x129
honnef.co/go/tools/unused.(*graph).decl(0xc0384b5608, {0x139b580?, 0xc06584cf00}, {0x0?, 0x0?})
honnef.co/go/[email protected]/unused/unused.go:1155 +0x191
honnef.co/go/tools/unused.(*graph).entry(0xc0384b5608)
honnef.co/go/[email protected]/unused/unused.go:523 +0xc28
honnef.co/go/tools/unused.run(0xc0b3fcc340)
honnef.co/go/[email protected]/unused/unused.go:219 +0x245
github.com/golangci/golangci-lint/pkg/golinters.runUnused(0xc0b3fcc340)
github.com/golangci/golangci-lint/pkg/golinters/unused.go:61 +0x48
github.com/golangci/golangci-lint/pkg/golinters.NewUnused.func1(0xfe65e0?)
github.com/golangci/golangci-lint/pkg/golinters/unused.go:31 +0x2f
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0032fd7e0)
github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:195 +0xa25
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:113 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc00143b680, {0x11376cd, 0x6}, 0xc03a60af48)
github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?)
github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:112 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0032fd7e0)
github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x208
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: unused: package "globalinformer" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: types.Object is nil, not *types.Func
INFO [runner] processing took 12.192µs with stages: max_same_issues: 3.763µs, skip_dirs: 1.776µs, filename_unadjuster: 1.329µs, nolint: 1.009µs, autogenerated_exclude: 723ns, identifier_marker: 647ns, max_from_linter: 441ns, skip_files: 317ns, fixer: 291ns, exclude-rules: 249ns, diff: 235ns, uniq_by_line: 219ns, cgo: 181ns, sort_results: 157ns, max_per_file_from_linter: 155ns, exclude: 154ns, path_prettifier: 152ns, source_code: 144ns, path_shortener: 91ns, severity-rules: 83ns, path_prefixer: 76ns
INFO [runner] linters took 1m34.501815533s with stages: goanalysis_metalinter: 1m34.501271808s
ERRO Running error: 1 error occurred:
* can't run linter goanalysis_metalinter: goanalysis_metalinter: unused: package "globalinformer" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: types.Object is nil, not *types.Func
ERRO Timeout exceeded: try increasing it by passing --timeout option