goimportcycle
goimportcycle copied to clipboard
panic when accessing the stubfile
Hi,
I ran the tool against my code base but it crashed, here's the error for reference
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x540393]
goroutine 9 [running]:
github.com/samlitowitz/goimportcycle/internal/ast.(*PrimitiveBuilder).addSelectorExpr(0x2?, 0xc0000c0c90)
/home/tilo/git/goimportcycle/internal/ast/primitive_builder.go:376 +0x353
github.com/samlitowitz/goimportcycle/internal/ast.(*PrimitiveBuilder).AddNode(0xc000153fb0?, {0x5b7008?, 0xc0000c0c90?})
/home/tilo/git/goimportcycle/internal/ast/primitive_builder.go:114 +0xc5
main.detectInputCycles.func1()
/home/tilo/git/goimportcycle/cmd/goimportcycle/main.go:109 +0xc6
created by main.detectInputCycles in goroutine 1
/home/tilo/git/goimportcycle/cmd/goimportcycle/main.go:101 +0xaf
Ive looked into it and found that there was call to a nil map. I've fixed it locally and can submit a PR.