We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code produces a panic:
func Drain[T <-chan E | chan E, E any](c T) { if c == nil { return } for range c { } }
$ staticcheck ./... panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x6d2e4a] goroutine 370 [running]: honnef.co/go/tools/go/ir.(*builder).rangeStmt(0xc000a62c80?, 0xc000a62c80, 0xc00033ba40, 0x0, {0x9d2718, 0xc00033ba40}) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2156 +0x34a honnef.co/go/tools/go/ir.(*builder).stmt(0x40c53d?, 0xc000a62c80, {0x9d41f8?, 0xc00033ba40?}) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2380 +0x83e honnef.co/go/tools/go/ir.(*builder).stmtList(0xc0006b3538?, 0x40e9a7?, {0xc0000db820?, 0x2, 0xc0006b3598?}) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:855 +0x67 honnef.co/go/tools/go/ir.(*builder).stmt(0xc000a62c80?, 0xc000a62c80, {0x9d3c88?, 0xc0005e1920?}) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2338 +0xd31 honnef.co/go/tools/go/ir.(*builder).buildFunction(0xc0006b3b00, 0xc000a62c80) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2450 +0x453 honnef.co/go/tools/go/ir.(*builder).buildFuncDecl(0xc000738700?, 0xc000270e10, 0xc0005e19e0) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2488 +0x195 honnef.co/go/tools/go/ir.(*Package).build(0xc000270e10) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2594 +0xc52 sync.(*Once).doSlow(0xc0007380e0?, 0xc00033b900?) /home/ldez/.gvm/gos/go1.18.4/src/sync/once.go:68 +0xc2 sync.(*Once).Do(...) /home/ldez/.gvm/gos/go1.18.4/src/sync/once.go:59 honnef.co/go/tools/go/ir.(*Package).Build(...) /home/ldez/sources/golangci-lint/go-tools/go/ir/builder.go:2512 honnef.co/go/tools/internal/passes/buildir.run(0xc000112410) /home/ldez/sources/golangci-lint/go-tools/internal/passes/buildir/buildir.go:86 +0x368 honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc00075b1d0, {0x9d52b8?, 0xc0000c2f00}) /home/ldez/sources/golangci-lint/go-tools/lintcmd/runner/runner.go:989 +0x614 honnef.co/go/tools/lintcmd/runner.genericHandle({0x9d52b8?, 0xc0000c2f00}, {0x9d52b8?, 0xc0000c2aa0?}, 0x0?, 0xc00040de00, 0xc00029ba70) /home/ldez/sources/golangci-lint/go-tools/lintcmd/runner/runner.go:814 +0x102 created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers /home/ldez/sources/golangci-lint/go-tools/lintcmd/runner/runner.go:1058 +0x705
Tested with v0.3.2 and HEAD of master (555b2d3)
$ staticcheck -version staticcheck 2022.1.2 (v0.3.2)
$ staticcheck -debug.version staticcheck 2022.1.2 (v0.3.2) Compiled with Go version: go1.18.4 Main module: honnef.co/go/tools Dependencies: github.com/BurntSushi/toml@v0.4.1 (sum: h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=) golang.org/x/exp/typeparams@v0.0.0-20220218215828-6cf2b201936e (sum: h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM=) golang.org/x/mod@v0.6.0-dev.0.20220419223038-86c51ed26bb4 (sum: h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=) golang.org/x/sys@v0.0.0-20211019181941-9d821ace8654 (sum: h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=) golang.org/x/tools@v0.1.11-0.20220513221640-090b14e8501f (sum: h1:OKYpQQVE3DKSc3r3zHVzq46vq5YH7x8xpR3/k9ixmUg=)
$ go version go version go1.18.4 linux/amd64
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/home/ldez/.cache/go-build" GOENV="/home/ldez/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/ldez/sources/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/ldez/sources/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/ldez/.gvm/gos/go1.18.4" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/ldez/.gvm/gos/go1.18.4/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18.4" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/ldez/sources/go/src/github.com/golangci/sandbox/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3379720613=/tmp/go-build -gno-record-gcc-switches"
Related to golangci/golangci-lint#2649 (comment)
The text was updated successfully, but these errors were encountered:
edb67bc
Fixed, thanks.
Sorry, something went wrong.
go/types/typeutil: compute correct core type for <-chan E | chan E
61defc0
We failed to account for bidirectional channels following unidirectional channels in the term list. Fixes gh-1304 (cherry picked from commit edb67bc)
No branches or pull requests
The following code produces a panic:
Tested with v0.3.2 and HEAD of master (555b2d3)
Related to golangci/golangci-lint#2649 (comment)
The text was updated successfully, but these errors were encountered: