-
Notifications
You must be signed in to change notification settings - Fork 29
Description
编译后:
[lh@master1 goanalysis]$ ls
cachePath.json cmd example go.mod go.sum LICENSE main main.go pkg README.md
执行go项目分析时报错:
[lh@master1 goanalysis]$ ./main analysis ../test/
2025/01/01 14:47:19 analysis dir: ../test/
use cache file: <./cachePath.json>
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7dc74c]
goroutine 1 [running]:
github.com/toheart/goanalysis/pkg/analysis.(*ProgramAst).ChildrenToPng(0xc00003c340, 0x0, 0x0, 0xc000054178)
/home/lh/works/goanalysis/pkg/analysis/tree.go:78 +0x4c
github.com/toheart/goanalysis/pkg/analysis.(*ProgramAnalysis).printPng(0xc00012c380)
/home/lh/works/goanalysis/pkg/analysis/analysis.go:330 +0x105
github.com/toheart/goanalysis/pkg/analysis.(*ProgramAnalysis).Print(0xc00012c380)
/home/lh/works/goanalysis/pkg/analysis/analysis.go:279 +0x6a
github.com/toheart/goanalysis/cmd.init.func2(0xc000154200?, {0xc0000322a0, 0x4?, 0x9bddb6?})
/home/lh/works/goanalysis/cmd/analysis.go:44 +0x293
github.com/spf13/cobra.(*Command).execute(0xf54d60, {0xc000032270, 0x1, 0x1})
/home/lh/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xf55040)
/home/lh/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/lh/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/toheart/goanalysis/cmd.Execute()
/home/lh/works/goanalysis/cmd/root.go:18 +0x1a
main.main()
/home/lh/works/goanalysis/main.go:9 +0xf