go-callvis
go-callvis copied to clipboard
panic: interface conversion: types.Type is nil, not *types.Signature
Version: v0.61 (current latest)
I get the following panic while analyzing a private piece of code:
myproject> go-callvis .
panic: interface conversion: types.Type is nil, not *types.Signature
goroutine 4220 [running]:
golang.org/x/tools/go/ssa.(*builder).expr0(0x1577a40?, 0xc0223843c0, {0x16e2988?, 0xc015f79c80}, {0x0, {0x0, 0x0}, {0x0, 0x0}})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:679 +0x1ba8
golang.org/x/tools/go/ssa.(*builder).expr(0x1576a80?, 0xc0223843c0, {0x16e2988?, 0xc015f79c80?})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:530 +0x19f
golang.org/x/tools/go/ssa.(*builder).expr0(0x1577a40?, 0xc0223843c0, {0x16e2c28?, 0xc008cd27c8}, {0x2, {0x16e1760, 0xc0032052c0}, {0x0, 0x0}})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:697 +0x14dd
golang.org/x/tools/go/ssa.(*builder).expr(0x1576a80?, 0xc0223843c0, {0x16e2c28?, 0xc008cd27c8?})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:530 +0x19f
golang.org/x/tools/go/ssa.(*builder).setCallFunc(0x80?, 0xc0223843c0?, 0xc003204200?, 0xc0248b92c0)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:881 +0x30c
golang.org/x/tools/go/ssa.(*builder).setCall(0x1577a40?, 0xc0223843c0, 0xc003204200, 0xc0248b92c0)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:962 +0x31
golang.org/x/tools/go/ssa.(*builder).expr0(0x1577a40?, 0xc0223843c0, {0x16e2688?, 0xc003204200}, {0x7, {0x16e1788, 0xc00d62a090}, {0x0, 0x0}})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:596 +0x1e9e
golang.org/x/tools/go/ssa.(*builder).expr(0xc0223843c0?, 0xc0223843c0, {0x16e2688?, 0xc003204200?})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:530 +0x19f
golang.org/x/tools/go/ssa.(*builder).stmt(0x0?, 0xc0223843c0, {0x16e2bc8?, 0xc015f79da0?})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2048 +0x2232
golang.org/x/tools/go/ssa.(*builder).stmtList(0x2030092?, 0x22970f34050?, {0xc0032040c0?, 0x4, 0x20?})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:790 +0x67
golang.org/x/tools/go/ssa.(*builder).stmt(0xc0223843c0?, 0xc0223843c0, {0x16e2628?, 0xc00c700b10?})
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2105 +0x18bd
golang.org/x/tools/go/ssa.(*builder).buildFunction(0x1577d40?, 0xc0223843c0)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2198 +0x47a
golang.org/x/tools/go/ssa.(*builder).buildFuncDecl(0x1576d20?, 0xc022302540, 0xc00c700b40)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2228 +0x154
golang.org/x/tools/go/ssa.(*Package).build(0xc022302540)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2344 +0xd25
sync.(*Once).doSlow(0x0?, 0x0?)
C:/Program Files/Go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
C:/Program Files/Go/src/sync/once.go:65
golang.org/x/tools/go/ssa.(*Package).Build(...)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2263
golang.org/x/tools/go/ssa.(*Program).Build.func1(0x0?)
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2247 +0x4c
created by golang.org/x/tools/go/ssa.(*Program).Build
C:/Users/redacted/Documents/Go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2246 +0x19c
The error goes away if I upgrade golang.org/x/tools:
go-callvis> go get golang.org/x/tools
go: downloading golang.org/x/tools v0.4.0
go: downloading golang.org/x/mod v0.7.0
go: downloading golang.org/x/sys v0.3.0
go: upgraded golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 => v0.7.0
go: upgraded golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f => v0.3.0
go: upgraded golang.org/x/tools v0.1.12 => v0.4.0
Same here.
Executed on Linux, not Windows.
Seeing this on macOS as well...
❯ go-callvis -version
v0.6.1 built from git (unknown)
❯ uname -a
Darwin John-s-S21-FE 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64
Similar issue, hinted by paolobelluticm's method to update x/tools, here's my trail to make it work:
- rm all older version packages related to go-callvis in pkg/mod
- cd to go-callvis dir or git clone go-callvis
- rm go.sum and change all version tag in go.mod, replace go 1.17 to go 1.19 or your version number
- go mod tidy
- go install .
the go.mod file then got reverted back to original version but it works though.
It is fixed in master, @ofabry could you perhaps create a new tag/release that includes this fix? Currently the version you install with go install ... is broken (it takes the latest tag which does not have this fix)
Same here and fixed with the dependency updating comment from @pmixer . Thanks!
I guess you must have used go install github.com/ofabry/go-callvis@latest . U can use the second install command to solve this problem.
git clone https://github.com/ofabry/go-callvis.git
cd go-callvis && make install