-
Notifications
You must be signed in to change notification settings - Fork 5
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
Linter throwing Panic #13
Comments
Give me a code to reproduce it. |
@kyoh86 I ran into this, here's a minimal test case I could form: |
It looks like https://github.com/kyoh86/exportloopref/blob/main/exportloopref.go#L301 |
Sorry for late. I cannot check it out up to 2 weeks ahead. |
No problem, take a look when you are free. Also, after looking at it a bit more, I think it might be safe to do a just a But I hope you get it eventually 👍 |
Thanks ! |
Linter crashed while building in Jenkins.
[2021-03-31T16:06:22.161Z] + golangci-lint run -c ./golangci.yaml [2021-03-31T16:06:48.663Z] level=warning msg="[linters context] Panic: exportloopref: package \"loggingapi\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 8231 [running]:\nruntime/debug.Stack(0xf2d9bd, 0x3c, 0xc002296578)\n\truntime/debug/stack.go:24 +0x9f\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1(0xc0038a1390)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:508 +0x1be\npanic(0xd76f60, 0x1541d70)\n\truntime/panic.go:965 +0x1b9\ngo/ast.(*Object).Pos(0x0, 0xc002296c20)\n\tgo/ast/scope.go:93 +0x29\ngithub.com/kyoh86/exportloopref.(*Searcher).isVar(0xc002296bf0, 0x10429d8, 0xc00c41eff0, 0x104b930, 0xc00f0cc6a0, 0xc00c41eff0)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:275 +0xb0\ngithub.com/kyoh86/exportloopref.(*Searcher).checkUnaryExpr(0xc002296bf0, 0xc00f0cc700, 0xc0000d6200, 0xd, 0x10, 0x0, 0x0, 0xf5a401)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:251 +0x3b8\ngithub.com/kyoh86/exportloopref.(*Searcher).Check(0xc002296bf0, 0x1042c58, 0xc00f0cc700, 0xc0000d6200, 0xd, 0x10, 0x0, 0x0, 0xc002296a01)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:100 +0xee\ngithub.com/kyoh86/exportloopref.run.func1(0x1042c58, 0xc00f0cc700, 0x1, 0xc0000d6200, 0xd, 0x10, 0x1)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:46 +0x8c\ngolang.org/x/tools/go/ast/inspector.(*Inspector).WithStack(0xc01ced4090, 0xc002296c80, 0x5, 0x5, 0xc00aab9c08)\n\tgolang.org/x/tools@v0.1.0/go/ast/inspector/inspector.go:126 +0x142\ngithub.com/kyoh86/exportloopref.run(0xc00dcfdee0, 0x592ac3264, 0x164e260, 0xc00871dbb8, 0x2)\n\tgithub.com/kyoh86/exportloopref@v0.1.8/exportloopref.go:45 +0x28b\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0038a1390)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:590 +0xa85\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:512 +0x2a\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc001e58500, 0xee921b, 0xd, 0xc0037cb770)\n\tgithub.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4d\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0038a1390)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:511 +0x91\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc00c73be50, 0xc0038a1390)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1059 +0x65\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:1054 +0x316\n" [2021-03-31T16:06:48.663Z] level=warning msg="[runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: exportloopref: package \"loggingapi\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference" [2021-03-31T16:06:48.663Z] level=error msg="Running error: goanalysis_metalinter: exportloopref: package \"loggingapi\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference" script returned exit code 3
The text was updated successfully, but these errors were encountered: