-
-
Notifications
You must be signed in to change notification settings - Fork 405
Closed
Labels
Description
example
package main
import "encoding/json"
func hello() int {
return 2
}
func main() {
_, err := json.Marshal(hello)
if err != nil {
panic(err)
}
}program runs with Go as expected
panic: json: unsupported type: func() int
but StaticCheck result is not expected
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x60 pc=0x12bbb13]
goroutine 233 [running]:
honnef.co/go/tools/staticcheck/sa1026.checkJSON(0x0?)
honnef.co/go/tools@v0.6.1/staticcheck/sa1026/sa1026.go:43 +0x93
honnef.co/go/tools/analysis/callcheck.checkCalls.func1(0x185a7d0?, {0x1515a38, 0xc0000cc790}, 0xc000079680)
honnef.co/go/tools@v0.6.1/analysis/callcheck/callcheck.go:81 +0x316
honnef.co/go/tools/analysis/callcheck.eachCall(0xc0003ad2c0, 0xc0005a31a8)
honnef.co/go/tools@v0.6.1/analysis/callcheck/callcheck.go:132 +0x14d
honnef.co/go/tools/analysis/callcheck.checkCalls(0xc0005a31e8?, 0xf1ddd3?)
honnef.co/go/tools@v0.6.1/analysis/callcheck/callcheck.go:122 +0x85
honnef.co/go/tools/staticcheck/sa1026.init.Analyzer.func1(0x139c800?)
honnef.co/go/tools@v0.6.1/analysis/callcheck/callcheck.go:49 +0x17
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc000586570, {0x150fa28?, 0xc00007c5a0})
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:988 +0x715
honnef.co/go/tools/lintcmd/runner.genericHandle({0x150fa28, 0xc00007c5a0}, {0x150fa28?, 0xc000380500?}, 0xc0004d4380, 0x0, 0xc0005a35f0)
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:813 +0x111
honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers(0xc00034e320, 0xc0000f8900, 0xc0000ec870)
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:1061 +0x71e
honnef.co/go/tools/lintcmd/runner.(*subrunner).doUncached(0xc00034e320, 0xc0000f8900)
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:716 +0x206
honnef.co/go/tools/lintcmd/runner.(*subrunner).do(0xc00034e320, {0x150fa70?, 0xc0000f8900})
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:573 +0x968
honnef.co/go/tools/lintcmd/runner.(*Runner).Run.func2({0x150fa70?, 0xc0000f8900?})
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:1227 +0x2a
honnef.co/go/tools/lintcmd/runner.genericHandle({0x150fa70, 0xc0000f8900}, {0x150fa70?, 0xc0000f87e0?}, 0xc000214380, 0xc00037c0a0, 0xc0001fc980)
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:813 +0x111
created by honnef.co/go/tools/lintcmd/runner.(*Runner).Run in goroutine 1
honnef.co/go/tools@v0.6.1/lintcmd/runner/runner.go:1226 +0x3d4
Reactions are currently unavailable