Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

linter staticcheck yields panic #33

Closed
feuGeneA opened this issue Sep 20, 2024 · 2 comments · Fixed by #36
Closed

linter staticcheck yields panic #33

feuGeneA opened this issue Sep 20, 2024 · 2 comments · Fixed by #36

Comments

@feuGeneA
Copy link
Contributor

Without any changes to the repo, running make lint results in this error:

$ make lint
gofmt -d -s .
gofumpt -d -extra .
go vet ./...
staticcheck ./...
panic: Cannot range over: func(yield func(K, V) bool)

goroutine 187 [running]:
honnef.co/go/tools/go/ir.(*builder).rangeStmt(0xc000847a60, 0xc000a88140, 0xc00058c8a0, 0x0, {0xa54190, 0xc00058c8a0})
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2181 +0x894
honnef.co/go/tools/go/ir.(*builder).stmt(0xc000847a60, 0xc000a88140, {0xa56600?, 0xc00058c8a0?})
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2394 +0x20a
honnef.co/go/tools/go/ir.(*builder).stmtList(...)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:847
honnef.co/go/tools/go/ir.(*builder).stmt(0xc000847a60, 0xc000a88140, {0xa56240?, 0xc0000e78c0?})
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2352 +0x1415
honnef.co/go/tools/go/ir.(*builder).buildFunction(0xc000847a60, 0xc000a88140)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2464 +0x417
honnef.co/go/tools/go/ir.(*builder).buildFuncDecl(0xc000847a60, 0xc0001a3170, 0xc0000e78f0)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2501 +0x189
honnef.co/go/tools/go/ir.(*Package).build(0xc0001a3170)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2605 +0xb46
sync.(*Once).doSlow(0xc00023dea0?, 0xc00058c060?)
	/opt/go/src/sync/once.go:76 +0xb4
sync.(*Once).Do(...)
	/opt/go/src/sync/once.go:67
honnef.co/go/tools/go/ir.(*Package).Build(...)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/go/ir/builder.go:2523
honnef.co/go/tools/internal/passes/buildir.run(0xc0004e0000)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/internal/passes/buildir/buildir.go:86 +0x18b
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc000628390, {0xa58c38?, 0xc0002775e0})
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/lintcmd/runner/runner.go:992 +0x71b
honnef.co/go/tools/lintcmd/runner.genericHandle({0xa58c38, 0xc0002775e0}, {0xa58c38?, 0xc000277540?}, 0xc000642a10, 0xc00043fe00, 0xc00060d330)
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/lintcmd/runner/runner.go:817 +0x11f
created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers in goroutine 186
	/home/gene/go/pkg/mod/honnef.co/go/tools@v0.4.2/lintcmd/runner/runner.go:1061 +0x6a6
make: *** [Makefile:37: lint] Error 2
@metachris
Copy link
Collaborator

did you try updating Go and staticcheck to the latest version?

@feuGeneA
Copy link
Contributor Author

I was already using the latest version of Go, but I had been using the version of staticcheck that's cited in the README. I updated to the latest staticcheck and it works great. I submitted a PR to update the README.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants