Open fgm opened 5 years ago
Yes, it does!
godepgraph -nostdlib -horizontal ./cmd/server | dot -Tpng -o godepgraph.png
Please update the README! I spent 20m to fight with this tool, until I found this ):
Actually it does not support Go modules:
➜ prometheus git:(master) ✗ godepgraph -nostdlib -horizontal ./cmd/prometheus
2020/04/09 12:13:42 failed to import github.com/jpillora/backoff (imported at level 3 by github.com/mwitkow/go-conntrack):
cannot find package "github.com/jpillora/backoff" in any of:
/home/bwplotka/.gvm/gos/go1.13.1/src/github.com/jpillora/backoff (from $GOROOT)
/home/bwplotka/Repos/prometheusgopath/src/github.com/jpillora/backoff (from $GOPATH)
go version
go version go1.13.1 **linux/amd64**
/pkg/mod/github.com/kisielk/godepgraph@v0.0.0-20190626013829-57a7e4a651a9/
For those of you searching "go package graph" and hitting a wall with this tool not supporting modules, you might want to follow https://github.com/Helcaraxan/gomod/issues/71. cc @Helcaraxan
Just to update after @mvdan's message that github.com/Helcaraxan/gomod now supports querying and visualising both the module and package dependency graphs of a given Go module since the v0.6.0 release that happened earlier today.
Although the command will start parsing dependencies, it fails at finding the imports in the modules cache, instead relying only on GOPATH/GOROOT.