ondrajz / go-callvis

Visualize call graph of a Go program using Graphviz
https://ofabry.github.io/go-callvis
MIT License
6k stars 422 forks source link

go 1.23.1 panic: runtime error: invalid memory address or nil pointer dereference #194

Open IsPHao opened 2 months ago

IsPHao commented 2 months ago

my code func main() { fmt.Println("hello") } I typed in the terminal "go-callvis ." return panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10f74c1cf]

goroutine 28 [running]: go/types.(Checker).handleBailout(0xc0002cc000, 0xc00029fbf0) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/check.go:404 +0x88 panic({0x10fd498a0?, 0x1101af990?}) /usr/local/Cellar/go/1.23.1/libexec/src/runtime/panic.go:785 +0x132 go/types.(StdSizes).Sizeof(0x0, {0x10fdec378, 0x1101b6860}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/sizes.go:229 +0x30f go/types.(Config).sizeof(...) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/sizes.go:334 go/types.representableConst.func1({0x10fdec378?, 0x1101b6860?}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/const.go:77 +0x86 go/types.representableConst({0x10fdefd78, 0x1101672f8}, 0xc0002cc000, 0x1101b6860, 0xc00029e9f8) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/const.go:93 +0x173 go/types.(Checker).representation(0xc0002cc000, 0xc0002c8440, 0x1101b6860) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/const.go:257 +0x65 go/types.(Checker).implicitTypeAndValue(0xc0002cc000, 0xc0002c8440, {0x10fdec378, 0x1101b6860}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:377 +0x2d7 go/types.(Checker).assignment(0xc0002cc000, 0xc0002c8440, {0x10fdec378, 0x1101b6860}, {0x10fbd0f02, 0xe}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/assignments.go:70 +0x451 go/types.(Checker).exprInternal(0xc0002cc000, 0x0, 0xc0002c8440, {0x10fdeed90, 0xc0001b4ec0}, {0x10fdec3c8, 0xc000196b60}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:1211 +0x1e0a go/types.(Checker).rawExpr(0xc0002cc000, 0x0, 0xc0002c8440, {0x10fdeed90?, 0xc0001b4ec0?}, {0x10fdec3c8?, 0xc000196b60?}, 0x0) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:981 +0x18c go/types.(Checker).exprWithHint(0xc0002cc000, 0xc0002c8440, {0x10fdeed90, 0xc0001b4ec0}, {0x10fdec3c8, 0xc000196b60}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:1599 +0x65 go/types.(Checker).indexedElts(0xc0002cc000, {0xc0001ac908, 0x24, 0xc00019f680?}, {0x10fdec3c8, 0xc000196b60}, 0xffffffffffffffff) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/index.go:453 +0x12f go/types.(Checker).exprInternal(0xc0002cc000, 0x0, 0xc0002c83c0, {0x10fdeed90, 0xc0001b5c80}, {0x0, 0x0}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:1283 +0xe7d go/types.(Checker).rawExpr(0xc0002cc000, 0x0, 0xc0002c83c0, {0x10fdeed90?, 0xc0001b5c80?}, {0x0?, 0x0?}, 0x0) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:981 +0x18c go/types.(Checker).expr(0xc0002cc000, 0x0?, 0xc0002c83c0, {0x10fdeed90?, 0xc0001b5c80?}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/expr.go:1549 +0x30 go/types.(Checker).varDecl(0xc0002cc000, 0xc00019f3e0, {0xc0001821b0, 0x1, 0x1}, {0x0, 0x0}, {0x10fdeed90, 0xc0001b5c80}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/decl.go:513 +0x17b go/types.(Checker).objDecl(0xc0002cc000, {0x10fdf73f8, 0xc00019f3e0}, 0x0) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/decl.go:188 +0x9a5 go/types.(Checker).packageObjects(0xc0002cc000) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/resolver.go:714 +0x454 go/types.(Checker).checkFiles(0xc0002cc000, {0xc0001820c0, 0x1, 0x1}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/check.go:459 +0x15a go/types.(Checker).Files(0xc0001fc0e0?, {0xc0001820c0?, 0xc00019f080?, 0x6?}) /usr/local/Cellar/go/1.23.1/libexec/src/go/types/check.go:422 +0x75 golang.org/x/tools/go/packages.(loader).loadPackage(0xc0001fc0e0, 0xc000113740) /Users/penghao/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:1052 +0xa32 golang.org/x/tools/go/packages.(loader).loadRecursive.func1() /Users/penghao/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:851 +0x1a9 sync.(Once).doSlow(0x0?, 0x0?) /usr/local/Cellar/go/1.23.1/libexec/src/sync/once.go:76 +0xb4 sync.(Once).Do(...) /usr/local/Cellar/go/1.23.1/libexec/src/sync/once.go:67 golang.org/x/tools/go/packages.(loader).loadRecursive(0x0?, 0x0?) /Users/penghao/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:839 +0x3b golang.org/x/tools/go/packages.(loader).loadRecursive.func1.1(0x0?) /Users/penghao/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:846 +0x26 created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 24 /Users/penghao/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:845 +0x94

IsPHao commented 2 months ago
image
helijia21 commented 2 months ago

the same go at 1.22

teslapatrick commented 2 months ago

Pls refer to [#177], this PR has not been merged yet.