I encountered such an error:
panic: interface conversion: *ssa.Call is not interface { ssa.setNum(int) }: missing method setNum
in file ssa/func.go:282.
Is this a bug?
I'll need more information, such as which tool you used, and a minimal example that reproduces the problem.
I call your interface directly on my project.
package simpler
import (
"myproject/simpler/lint/lintutil"
)
func Simpler(projectPath map[string]string) []string {
fs := lintutil.FlagSet("gosimple")
gen := fs.Bool("generated", false, "Check generated code")
var paths []string
for _, path := range projectPath {
paths = append(paths, path)
}
fs.Parse(paths)
c := NewChecker()
c.CheckGenerated = *gen
return lintutil.ProcessFlagSet(c, fs)
}
This all error information:
panic: interface conversion: *ssa.Call is not interface { ssa.setNum(int) }: missing method setNum
goroutine 1937 [running]:
myproject/simpler/ssa.numberRegisters(0xc443f26780)
/Users/gopath/src/myproject/simpler/ssa/func.go:282 +0x114
myproject/simpler/ssa.(*Function).finishBody(0xc443f26780)
/Users/gopath/src/myproject/simpler/ssa/func.go:348 +0x262
myproject/simpler/ssa.makeWrapper(0xc442631c20, 0xc4436bde00, 0x0)
/Users/gopath/src/myproject/simpler/ssa/wrappers.go:137 +0x789
myproject/simpler/ssa.(*Program).addMethod(0xc442631c20, 0xc443e29fc0, 0xc4436bde00, 0xc443e29fc0)
/Users/gopath/src/myproject/simpler/ssa/methods.go:86 +0x14d
myproject/simpler/ssa.(*Program).needMethods(0xc442631c20, 0x19cfaa0, 0xc443e29fb0, 0xc443d60c00)
/Users/gopath/src/myproject/simpler/ssa/methods.go:175 +0xaf3
myproject/simpler/ssa.(*Program).needMethods(0xc442631c20, 0x19cfa60, 0xc4309ff230, 0x1ce0a00)
/Users/gopath/src/myproject/simpler/ssa/methods.go:217 +0x93e
myproject/simpler/ssa.(*Program).needMethods(0xc442631c20, 0x19cfba0, 0xc42a06d3e0, 0xc443efbe00)
/Users/gopath/src/myproject/simpler/ssa/methods.go:235 +0x2ee
myproject/simpler/ssa.(*Program).needMethods(0xc442631c20, 0x19cfaa0, 0xc443e29eb0, 0xc443eedc00)
/Users/gopath/src/myproject/simpler/ssa/methods.go:183 +0x1c1
myproject/simpler/ssa.(*Program).needMethods(0xc442631c20, 0x19cfa60, 0xc435626510, 0x0)
/Users/gopath/src/myproject/simpler/ssa/methods.go:217 +0x93e
myproject/simpler/ssa.(*Program).needMethodsOf(0xc442631c20, 0x19cfa60, 0xc435626510)
/Users/gopath/src/myproject/simpler/ssa/methods.go:147 +0x5d
myproject/simpler/ssa.(*Package).build(0xc443ac3080)
/Users/gopath/src/myproject/simpler/ssa/builder.go:2276 +0x1619
myproject/simpler/ssa.(*Package).(myproject/simpler/ssa.build)-fm()
/Users/gopath/src/myproject/simpler/ssa/builder.go:2260 +0x2a
sync.(*Once).Do(0xc443ac30ac, 0xc443f38f98)
/usr/local/Cellar/go/1.8/libexec/src/sync/once.go:44 +0xbe
myproject/simpler/ssa.(*Package).Build(0xc443ac3080)
/Users/gopath/src/myproject/simpler/ssa/builder.go:2260 +0x55
myproject/simpler/ssa.(*Program).Build.func1(0xc443e299b0, 0xc443ac3080)
/Users/gopath/src/myproject/simpler/ssa/builder.go:2244 +0x2b
created by myproject/simpler/ssa.(*Program).Build
/Users/gopath/src/myproject/simpler/ssa/builder.go:2246 +0x141
I still need to see what code you're running your tool on that is causing the failure. Surely it is not failing on all code (you can confirm with ./your_tool fmt, for example.)
I import your package staticcheck in goreporter(branch:feature-3.0) and the
URL:https://github.com/360EntSecGroup-Skylar/goreporter/tree/feature-3.0/engine
Run the command:
go get github.com/wgliang/logcool
then
go test
you will reproducethe problem.
A guess is that this is related to the fact that the packages in this repository use a custom ssa fork (its source is at https://github.com/dominikh/go-tools/tree/master/ssa), and you might be importing a different, incompatible, ssa package in your project somewhere.
I am very sure that I am importing the correct package.
I'm sorry, but I am not interested in digging through github.com/360EntSecGroup-Skylar/goreporter and github.com/wgliang/logcool or in following vague instructions (neither of these packages has top-level tests, so go test does nothing for me).
I asked for a minimal example, not thousands of lines of code with dependencies, scripts and so on. The minimal amount of code necessary to trigger the bug, as self-contained as possible. Ideally a single file, no longer than ~200 lines of code, that triggers the bug simply by running it.
Timed out.
Most helpful comment
I'm sorry, but I am not interested in digging through github.com/360EntSecGroup-Skylar/goreporter and github.com/wgliang/logcool or in following vague instructions (neither of these packages has top-level tests, so
go testdoes nothing for me).I asked for a minimal example, not thousands of lines of code with dependencies, scripts and so on. The minimal amount of code necessary to trigger the bug, as self-contained as possible. Ideally a single file, no longer than ~200 lines of code, that triggers the bug simply by running it.