dominikh / go-tools

Staticcheck - The advanced Go linter
https://staticcheck.dev
MIT License
6.21k stars 377 forks source link

`panic: runtime error: index out of range [0] with length 0` #1572

Closed qarmin closed 4 months ago

qarmin commented 4 months ago

go - 1.22~2build1 Ubuntu 24.04 staticheck - b36ec99704afeb51e2a8608add554d19f06326c6

rafal@rafal-komputer:~/Downloads/NORMAL_1-before(3)$ ~/go/bin/staticcheck -checks all A.go 
panic: runtime error: index out of range [0] with length 0

goroutine 257 [running]:
honnef.co/go/tools/staticcheck/sa4005.run(0xc0002920e0)
    /home/rafal/test/gotools/staticcheck/sa4005/sa4005.go:52 +0xeb8
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc0001ec180, {0xa4d858?, 0xc000301cc0})
    /home/rafal/test/gotools/lintcmd/runner/runner.go:988 +0x71b
honnef.co/go/tools/lintcmd/runner.genericHandle({0xa4d858, 0xc000301cc0}, {0xa4d858?, 0xc000300460?}, 0xc0001dda40, 0xc0001302b0, 0xc0002fbaa0)
    /home/rafal/test/gotools/lintcmd/runner/runner.go:813 +0x11f
created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers in goroutine 210
    /home/rafal/test/gotools/lintcmd/runner/runner.go:1057 +0x6a6
rafal@rafal-komputer:~/Downloads/NORMAL_1-before(3)$ ~/go/bin/staticcheck -checks all B.go 
panic: runtime error: index out of range [0] with length 0

goroutine 151 [running]:
honnef.co/go/tools/staticcheck/sa4005.run(0xc0003155e0)
    /home/rafal/test/gotools/staticcheck/sa4005/sa4005.go:52 +0xeb8
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc0002c7d10, {0xa4d858?, 0xc00019f360})
    /home/rafal/test/gotools/lintcmd/runner/runner.go:988 +0x71b
honnef.co/go/tools/lintcmd/runner.genericHandle({0xa4d858, 0xc00019f360}, {0xa4d858?, 0xc000114b40?}, 0xc00029f020, 0x0, 0xc0007a1308)
    /home/rafal/test/gotools/lintcmd/runner/runner.go:813 +0x11f
honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers(0xc0002de1e0, 0xc00014a7e0, 0xc00021a0f0)
    /home/rafal/test/gotools/lintcmd/runner/runner.go:1061 +0x707
honnef.co/go/tools/lintcmd/runner.(*subrunner).doUncached(0xc0002de1e0, 0xc00014a7e0)
    /home/rafal/test/gotools/lintcmd/runner/runner.go:716 +0x1c9
honnef.co/go/tools/lintcmd/runner.(*subrunner).do(0xc0002de1e0, {0xa4d8a0?, 0xc00014a7e0})
    /home/rafal/test/gotools/lintcmd/runner/runner.go:573 +0x9a8
honnef.co/go/tools/lintcmd/runner.(*Runner).Run.func2({0xa4d8a0?, 0xc00014a7e0?})
    /home/rafal/test/gotools/lintcmd/runner/runner.go:1227 +0x2a
honnef.co/go/tools/lintcmd/runner.genericHandle({0xa4d8a0, 0xc00014a7e0}, {0xa4d8a0?, 0xc00014a6c0?}, 0xc000100180, 0xc00042a0a0, 0xc0005d83c0)
    /home/rafal/test/gotools/lintcmd/runner/runner.go:813 +0x11f
created by honnef.co/go/tools/lintcmd/runner.(*Runner).Run in goroutine 1
    /home/rafal/test/gotools/lintcmd/runner/runner.go:1226 +0x3d4

Files - NORMAL_1-before(3).zip