staticcheck probably needs to be recompiled with go 1.22
Description:
When checking a go project with "go 1.22" in its go.mod file, staticcheck crashes with:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x5c19939a5f32]
goroutine 210 [running]:
honnef.co/go/tools/go/ir.memberFromObject(0xc00018e360, {0x0, 0x0?}, {0x5c1993c9eee8?, 0xc00037e0a0})
/build/staticcheck/src/go-tools-2023.1.6/go/ir/create.go:54 +0x52
honnef.co/go/tools/go/ir.membersFromDecl(0xc00018e360, {0x5c1993ca0718?, 0xc00046c1c0?})
/build/staticcheck/src/go-tools-2023.1.6/go/ir/create.go:146 +0x1d4
honnef.co/go/tools/go/ir.(*Program).CreatePackage(0xc000730380, 0xc000759560, {0xc0001de010, 0x1, 0x1}, 0xc00037e050, 0x0)
/build/staticcheck/src/go-tools-2023.1.6/go/ir/create.go:207 +0x7a5
honnef.co/go/tools/internal/passes/buildir.run(0xc000218f70)
/build/staticcheck/src/go-tools-2023.1.6/internal/passes/buildir/buildir.go:85 +0x165
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc00044d080, {0x5c1993ca2008?, 0xc00089e460})
/build/staticcheck/src/go-tools-2023.1.6/lintcmd/runner/runner.go:992 +0x6fd
honnef.co/go/tools/lintcmd/runner.genericHandle({0x5c1993ca2008?, 0xc00089e460}, {0x5c1993ca2008?, 0xc00089e3c0?}, 0x0?, 0xc0003d2e90, 0xc00020d910)
/build/staticcheck/src/go-tools-2023.1.6/lintcmd/runner/runner.go:817 +0x129
created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers in goroutine 194
/build/staticcheck/src/go-tools-2023.1.6/lintcmd/runner/runner.go:1061 +0x6b5
It seems like recompiling staticcheck with go 1.22 fixes the issue.
Additional info:
- package version(s): go 2:1.22.0-1 and staticcheck 2023.1.6-1