ondrajz / go-callvis

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

Visualize source written declaratively through a dependency (for instance a cli using spf13/cobra) #128

Closed nanvenomous closed 1 year ago

nanvenomous commented 1 year ago

I am trying to visualize a project I wrote which is a super simple CLI to run neovim sessions. I first ran a basic go-callvis ./... which yielded: basic_viz after reading through the usage examples I have tried several combinations of the -group, -focus, and -limit flags, however all seem to give me way too much spf13/cobra or not enough of my actual package nanvenomous/e

Tell me if I'm being naive, but is there a way to treat dependencies as a "black box" and just visualize all of the source of main module when the dependencies are a "pass-through" layer?

nanvenomous commented 1 year ago

After some more time playing around it seems, since the business logic of a spf13/cobra application is in the cmd package the correct usage is to run: go-callvis -focus "cmd" -group pkg,type -ignore github.com/spf13 ./... from the root of your cobra project