Repository navigation
Closed
Labels
Description
- The output of 'staticcheck -version'
staticcheck 2023.1.6 (v0.4.6)
- The output of 'staticcheck -debug.version' (it is fine if this command fails)
staticcheck 2023.1.6 (v0.4.6)
Compiled with Go version: go1.21.5
Main module:
honnef.co/go/tools@v0.4.6 (sum: h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8=)
Dependencies:
github.com/BurntSushi/toml@v1.2.1 (sum: h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=)
golang.org/x/exp/typeparams@v0.0.0-20221208152030-732eee02a75a (sum: h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE=)
golang.org/x/mod@v0.12.0 (sum: h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=)
golang.org/x/sys@v0.11.0 (sum: h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=)
golang.org/x/tools@v0.12.1-0.20230825192346-2191a27a6dc5 (sum: h1:Vk4mysSz+GqQK2eqgWbo4zEO89wkeAjJiFIr9bpqa8k=)
- The output of 'go version'
go version go1.21.5 darwin/amd64
- The output of 'go env'
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/James-Peach/Library/Caches/go-build'
GOENV='/Users/James-Peach/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/James-Peach/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/James-Peach/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.21.5/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.21.5/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/James-Peach/tmp/d/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/70/q8fzmf_13jjd48wwyx0q2vt40000gp/T/go-build3041352250=/tmp/go-build -gno-record-gcc-switches -fno-common'
- Exactly which command you ran
- Output of the command and what's wrong with the output
staticcheck --debug.run-quickfix-analyzers ./...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1375d45]
goroutine 254 [running]:
honnef.co/go/tools/quickfix.CheckDeMorgan.func1.1({0x16008f8?, 0xc00017b9b0?})
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/quickfix/lint.go:141 +0x65
go/ast.inspector.Visit(0xc00039c150, {0x16008f8?, 0xc00017b9b0?})
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:386 +0x2b
go/ast.Walk({0x15fe320?, 0xc00039c150?}, {0x16008f8?, 0xc00017b9b0?})
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:51 +0x5c
go/ast.walkExprList(...)
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:26
go/ast.Walk({0x15fe320?, 0xc00039c150?}, {0x16004c0?, 0xc0002c5600?})
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:105 +0x2225
go/ast.Walk({0x15fe320?, 0xc00039c150?}, {0x1600470?, 0xc00017b9e0?})
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:116 +0x44d
go/ast.Walk({0x15fe320?, 0xc00039c150?}, {0x1600038?, 0xc00017ba10?})
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:153 +0x829
go/ast.Walk({0x15fe320?, 0xc00039c150?}, {0x1600038?, 0xc00017ba40?})
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:153 +0x829
go/ast.Inspect(...)
/usr/local/Cellar/go/1.21.5/libexec/src/go/ast/walk.go:397
honnef.co/go/tools/quickfix.CheckDeMorgan.func1({0x1601bf0?, 0xc00017ba40})
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/quickfix/lint.go:139 +0xb7
honnef.co/go/tools/quickfix.CheckDeMorgan.func2({0x1600218?, 0xc00047a6e0}, {0xc000037a00, 0x5, 0x8?})
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/quickfix/lint.go:162 +0x169
honnef.co/go/tools/quickfix.CheckDeMorgan.PreorderStack.func3({0x1600218?, 0xc00047a6e0?}, 0x0?, {0xc000037a00?, 0x14a7e00?, 0x0?})
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/analysis/code/visit.go:22 +0x37
golang.org/x/tools/go/ast/inspector.(*Inspector).WithStack(0xc000126318, {0xc00034cdf8?, 0x1?, 0x1b0c1c0?}, 0xc0003b7de8)
/Users/James-Peach/go/pkg/mod/golang.org/x/tools@v0.12.1-0.20230825192346-2191a27a6dc5/go/ast/inspector/inspector.go:148 +0x193
honnef.co/go/tools/analysis/code.PreorderStack(...)
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/analysis/code/visit.go:20
honnef.co/go/tools/quickfix.CheckDeMorgan(0x1498120?)
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/quickfix/lint.go:217 +0xcf
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc0001e2780, {0x1603888?, 0xc0000b1360})
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/lintcmd/runner/runner.go:992 +0x6fd
honnef.co/go/tools/lintcmd/runner.genericHandle({0x1603888?, 0xc0000b1360}, {0x1603888?, 0xc00012db80?}, 0x0?, 0xc000433030, 0xc000382a00)
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/lintcmd/runner/runner.go:817 +0x129
created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers in goroutine 145
/Users/James-Peach/go/pkg/mod/honnef.co/go/tools@v0.4.6/lintcmd/runner/runner.go:1061 +0x6b5
Reproduced with this code:
package main
import "fmt"
type Info struct {
idx int
}
var state map[Info]int
func do() bool {
return !(state[Info{idx: 6}] == 6 || false)
}
func main() {
if do() {
fmt.Println("done")
}
}
Activity
qf1001: handle expressions that have no type