ondrajz / go-callvis

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

Crash using empty -focus #54

Closed lacombar closed 4 years ago

lacombar commented 4 years ago

Trying to get the call-graph of an app with a lot of sub-packages and using the trick specified in https://github.com/TrueFurby/go-callvis/issues/28


panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x89e7d7]

goroutine 1 [running]:
main.(*analysis).render(0xc031240640, 0x7ffd60155567, 0x0, 0xc007f75a70, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
        /misc/go-callvis/analysis.go:123 +0x77
main.outputDot(0x7ffd6015554b, 0x9, 0x9bfcc3, 0x3)
        /misc/go-callvis/main.go:64 +0x316
main.main()
        /misc/go-callvis/main.go:120 +0x3f5```
quantonganh commented 4 years ago
06:14:14.435366 http serving at http://localhost:7878
06:14:14.755000 ----------------------
06:14:14.759540  => handling request:  /
06:14:14.759551 ----------------------
06:14:14.759691 http: panic serving [::1]:59968: runtime error: invalid memory address or nil pointer dereference
goroutine 3822 [running]:
net/http.(*conn).serve.func1(0xc0000cc140)
    /usr/local/Cellar/go/1.13/libexec/src/net/http/server.go:1767 +0x139
panic(0x1522300, 0x19e1510)
    /usr/local/Cellar/go/1.13/libexec/src/runtime/panic.go:679 +0x1b2
main.(*analysis).render(0xc072e04000, 0x7ffeefbff711, 0x0, 0xc0381d00d0, 0x1, 0x1, 0xc0381d00f0, 0x1, 0x1, 0xc0381d0110, ...)
    /Users/quanta/go/src/github.com/TrueFurby/go-callvis/analysis.go:123 +0x77
main.handler(0x1687260, 0xc038792000, 0xc03834e100)
    /Users/quanta/go/src/github.com/TrueFurby/go-callvis/handler.go:113 +0x5b3
net/http.HandlerFunc.ServeHTTP(0x15e36c8, 0x1687260, 0xc038792000, 0xc03834e100)
    /usr/local/Cellar/go/1.13/libexec/src/net/http/server.go:2007 +0x44
net/http.(*ServeMux).ServeHTTP(0x19ef7e0, 0x1687260, 0xc038792000, 0xc03834e100)
    /usr/local/Cellar/go/1.13/libexec/src/net/http/server.go:2387 +0x1bd
net/http.serverHandler.ServeHTTP(0xc0389541c0, 0x1687260, 0xc038792000, 0xc03834e100)
    /usr/local/Cellar/go/1.13/libexec/src/net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc0000cc140, 0x16880e0, 0xc072e26000)
    /usr/local/Cellar/go/1.13/libexec/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
    /usr/local/Cellar/go/1.13/libexec/src/net/http/server.go:2927 +0x38e

Looks like it caused by this commit: https://github.com/TrueFurby/go-callvis/commit/deb869bdd75efeca2ec1f25ac7a1a8509dabb938#diff-93027c7b7b59812efa3717a7ef539251