-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
goanalysis_metalinter panics for generic internal package #2675
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello, As I explained here and here, if you are using generics you have to set the following configuration: run:
go: 1.18 https://golangci-lint.run/usage/configuration/#run-configuration |
👍 what do you think about adding this config to the release notes for 1.45 or would you accept a PR to document this outside of issues? |
I'm working on the autodetection of the Go version #2669 |
@ldez thank you for your hard work and keeping your head up. I feel sorry for commenting on a closed issue when there's probably plenty of activity around this project right now. I am still running into the issue as described by OP even though I set The panic does still exist and I'll try to provide you with a minimal example to reproduce. $ golangci-lint version
golangci-lint has version v1.45.0 built from (unknown, mod sum: "h1:T2oCVkYoeckBxcNS6DTYiSXN2QcTNuAWaHyLGfqzMlU=") on (unknown)
$ golangci-lint run
level=warning msg="[runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive."
level=warning msg="[runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. "
level=warning msg="[linters context] bodyclose is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=error msg="[runner] Panic: buildssa: package \"eventbus\" (isInitialPkg: true, needAnalyzeSource: true): T: goroutine 4252 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:101 +0x155\npanic({0x142bae0, 0xc0090fc750})\n\t/usr/local/go/src/runtime/panic.go:838 +0x207\ngolang.org/x/tools/go/ssa.(*Program).needMethods(0xc0029a1790, {0x16e36d0?, 0xc0090fc750?}, 0x0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:237 +0x5b1\ngolang.org/x/tools/go/ssa.(*Program).needMethods(0xc0029a1790, {0x16e34c8?, 0xc00e1e3368?}, 0x0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:199 +0x4e8\ngolang.org/x/tools/go/ssa.(*Program).needMethods(0xc0029a1790, {0x16e36a8?, 0xc00e1e3380?}, 0x0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:233 +0x708\ngolang.org/x/tools/go/ssa.(*Program).needMethods(0xc0029a1790, {0x16e3568?, 0xc007672310?}, 0x0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:182 +0x1ce\ngolang.org/x/tools/go/ssa.(*Program).needMethods(0xc0029a1790, {0x16e36a8?, 0xc00e1e2ee8?}, 0x0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:233 +0x708\ngolang.org/x/tools/go/ssa.(*Program).needMethods(0xc0029a1790, {0x16e3608?, 0xc00a5be240?}, 0x0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:210 +0x46a\ngolang.org/x/tools/go/ssa.(*Program).needMethodsOf(0xc0029a1790, {0x16e3608?, 0xc00a5be240?})\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/methods.go:145 +0x70\ngolang.org/x/tools/go/ssa.(*Package).build(0xc009558300)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/builder.go:2284 +0x111\nsync.(*Once).doSlow(0xc0029a1790?, 0xc00421bf40?)\n\t/usr/local/go/src/sync/once.go:68 +0xc2\nsync.(*Once).Do(...)\n\t/usr/local/go/src/sync/once.go:59\ngolang.org/x/tools/go/ssa.(*Package).Build(...)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/ssa/builder.go:2272\ngolang.org/x/tools/go/analysis/passes/buildssa.run(0xc0029a15f0)\n\t/go/pkg/mod/golang.org/x/tools@v0.1.10/go/analysis/passes/buildssa/buildssa.go:72 +0x2ee\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0016ceeb0)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:105 +0x1d\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc00153e730, {0x149743f, 0x8}, 0xc001b64f48)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/timeutils/stopwatch.go:111 +0x4a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0003427e0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_action.go:104 +0x85\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0016ceeb0)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.45.0/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb\n"
level=warning msg="[runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildssa: package \"eventbus\" (isInitialPkg: true, needAnalyzeSource: true): T"
level=warning msg="[linters context] gosimple is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] noctx is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] rowserrcheck is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] staticcheck is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] stylecheck is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] unparam is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=warning msg="[linters context] unused is disabled because of go1.18. If you are not using go1.18, you can set `go: go1.17` in the `run` section. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: goanalysis_metalinter: buildssa: package \"eventbus\" (isInitialPkg: true, needAnalyzeSource: true): T\n\n" Edit: The issue here is that I did have a .golangci.yml with linters like For reference I did add all the comments and it started to work, but it fails without the comments: run:
go: 1.18
tests: true
skip-files:
- ".+_test.go"
- "mock_.+"
modules-download-mode: vendor
linters-settings:
lll:
line-length: 200
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
golint:
min-confidence: 0.4
misspell:
locale: US
linters:
disable-all: true
enable:
#- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exhaustive
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- revive
- goprintffuncname
- gosec
#- gosimple
- govet
- ineffassign
- lll
- misspell
#- noctx
#- rowserrcheck
- exportloopref
#- staticcheck
- structcheck
#- stylecheck
- typecheck
- unconvert
#- unparam
#- unused
- varcheck
- whitespace
- nolintlint |
@joa can you open a new issue?
With the new option, linters like |
It seems to be more complicated. The output of my runner is at v1.45.0 (as shown) but my local machine was not. Hence it worked when I documented out |
@ldez The difference was that I still used |
I've also encountered this issue with 1.46.2 and
The |
Welcome
Description of the problem
Using
golangci-lint run
ongithub.com/BooleanCat/go-functional@v0.6.0
causes a panic withcan't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "assert" (isInitialPkg: true, needAnalyzeSource: true): T
Version of golangci-lint
Configuration file
No configuration file.
Go environment
Verbose output of running
Code example or link to a public repository
https://github.com/BooleanCat/go-functional
The text was updated successfully, but these errors were encountered: