-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Running error: can't run linter goanalysis_metalinter #4482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello, can you provide a reproducible code example and your configuration? |
This issue doesn't provide:
With the stacktrace, the only things that I can know are it may be related to the Without more information, it can take days to find out how to recreate the problem (if the problem can be recreated) and how to fix it. If you are facing the same problem, the best way to contribute is to provide the following information: A code example or link to a public repository.
|
I have this same issue on https://gitlab.com/accumulatenetwork/accumulate/ when I update to golangci-lint bleeding edge (for the new plugin system). Once I work around it for production I'll try to make a repro branch. Ultimately it appears there's a bug in golang.org/x/tools. |
golangci-repro-4482 reproduces the panic on my PC. Reverting golang.org/x/tools to v0.18.0 resolves the issue. Here's the full log: logINFO [config_reader] Config search paths: [./ /home/firelizzard/src/Accumulate/accumulate /home/firelizzard/src/Accumulate /home/firelizzard/src /home/firelizzard /home /] INFO [config_reader] Used config file .golangci.yml INFO Loaded : rangevarref INFO Loaded : noprint INFO Loaded : nodebug INFO [lintersdb] Active 1 linters: [govet] INFO [loader] Go packages loading at mode 575 (name|compiled_files|deps|exports_file|files|imports|types_sizes) took 448.562894ms INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 45.95519ms INFO [linters_context/goanalysis] analyzers took 636.641834ms with top 10 stages: inspect: 117.639198ms, printf: 89.964436ms, ctrlflow: 62.623472ms, copylocks: 53.980913ms, assign: 29.201073ms, lostcancel: 26.764156ms, bools: 21.786709ms, composites: 18.945616ms, unsafeptr: 17.460426ms, unreachable: 15.820847ms ERRO [runner] Panic: httpresponse: package "simulator" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 28424 [running]: runtime/debug.Stack() /home/firelizzard/sdk/go1.22.1/src/runtime/debug/stack.go:24 +0x5e github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1() /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:108 +0x277 panic({0x16e86a0?, 0x2327480?}) /home/firelizzard/sdk/go1.22.1/src/runtime/panic.go:770 +0x132 go/types.(*Named).Obj(...) /home/firelizzard/sdk/go1.22.1/src/go/types/named.go:295 golang.org/x/tools/go/analysis/passes/internal/analysisutil.IsNamedType({0x1afa470?, 0x0?}, {0x185e739, 0x8}, {0xc0027ebaf8, 0x1, 0x928645?}) /home/firelizzard/go/pkg/mod/golang.org/x/[email protected]/go/analysis/passes/internal/analysisutil/util.go:123 +0x49 golang.org/x/tools/go/analysis/passes/httpresponse.isHTTPFuncOrMethodOnClient(0xc00dd04240, 0xc014064100?) /home/firelizzard/go/pkg/mod/golang.org/x/[email protected]/go/analysis/passes/httpresponse/httpresponse.go:122 +0xfb golang.org/x/tools/go/analysis/passes/httpresponse.run.func1({0x1af9b10?, 0xc00cdc7c80?}, 0x10?, {0xc014064100, 0xc, 0x10}) /home/firelizzard/go/pkg/mod/golang.org/x/[email protected]/go/analysis/passes/httpresponse/httpresponse.go:62 +0x73 golang.org/x/tools/go/ast/inspector.(*Inspector).WithStack(0xc0124d1d88, {0xc0034c64b8?, 0x2353000?, 0x600?}, 0xc00164bcc8) /home/firelizzard/go/pkg/mod/golang.org/x/[email protected]/go/ast/inspector/inspector.go:148 +0x188 golang.org/x/tools/go/analysis/passes/httpresponse.run(0xc01df8bc70) /home/firelizzard/go/pkg/mod/golang.org/x/[email protected]/go/analysis/passes/httpresponse/httpresponse.go:57 +0x112 github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc00353b5b0) /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:190 +0xa02 github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2() /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:112 +0x17 github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc00259e910, {0x18a8df4, 0xc}, 0xc0034c6748) /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/timeutils/stopwatch.go:111 +0x44 github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc00045e2a0?) /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:111 +0x7a github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc00353b5b0) /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xa8 created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze in goroutine 800 /home/firelizzard/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x205 WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: httpresponse: package "simulator" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference INFO [runner] processing took 1.973µs with stages: max_same_issues: 474ns, skip_dirs: 237ns, nolint: 167ns, max_from_linter: 131ns, cgo: 105ns, autogenerated_exclude: 97ns, exclude-rules: 95ns, skip_files: 94ns, identifier_marker: 94ns, path_prettifier: 90ns, filename_unadjuster: 89ns, fixer: 37ns, diff: 31ns, severity-rules: 30ns, uniq_by_line: 30ns, sort_results: 30ns, exclude: 30ns, source_code: 30ns, path_shortener: 28ns, path_prefixer: 27ns, max_per_file_from_linter: 27ns INFO [runner] linters took 554.127017ms with stages: goanalysis_metalinter: 554.104557ms ERRO Running error: can't run linter goanalysis_metalinter goanalysis_metalinter: httpresponse: package "simulator" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference INFO Memory: 12 samples, avg is 188.0MB, max is 536.2MB INFO Execution took 1.051656194s |
Thank you, as a temporary fix, I will revert golang.org/x/tools |
sadly we cannot revert easily... 😢 It's related to this commit golang/tools@c111c4dfa I know where the bug is but I don't find a way to create a minimal reproducible example. |
I submitted a bug report golang/go#66259 The problem is related to I found the problem -> golang/go#66259 (comment) |
I stripped down Thanks for your work on tracing this to the root cause. |
I created a minimal example with only 2 files (it was not fun to remove all your code file by file and line by line 😄) The feedback on the Go issue is sparse, the CL attached will fix the problem but we have to wait |
Fixed by #4620 |
thanks @ldez |
Welcome
Description of the problem
Pull the latest code and use make build. It cannot be exploded accordingly.
GoLang Version: 1.21.8
golangci-lint Version: latest master make build
Version of golangci-lint
Configuration
# paste configuration file or CLI flags here
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
// add your code here
Validation
The text was updated successfully, but these errors were encountered: