Rework of godepgraph using execing go list -json
to gather info about packages.
go get github.com/paulbuis/golistdepgraph
For basic usage, just give the package path of interest as the first argument:
golistdepgraph github.com/paulbuis/golistdepgraph
The output is a graph in Graphviz dot format. If you have the
graphviz tools installed you can render it by piping the output to dot
:
golistdepgraph github.com/paulbuis/golistdepgraph | dot -Tpng -o godepgraph.png
By default golistdepgraph will display packages in the standard library in the graph, though it will not delve in to their dependencies.
If you want to ignore standard library packages entirely, use the -s
flag:
golistdepgraph -s github.com/paulbuis/golistdepgraph
Import paths can be included in a comma-separated list passed to the -i
flag:
golistdepgraph -i github.com/foo/bar,github.com/baz/blah github.com/something/else
The packages and their imports will be excluded from the graph, unless the imports are also imported by another package which is not excluded.
Import paths can also be ignored by prefix. The -p
flag takes a comma-separated
list of prefixes:
golistdepgraph -p github.com,launchpad.net bitbucket.org/foo/bar
golistdepgraph -d github.com/paulbuis/golistdepgraph
golistdepgraph -t github.com/paulbuis/golistdepgraph
The current version of golistdepgraph simply execs the go list -json
command and uses whatever it produces with the
current environment variables. It does not pass any build tags on to the go
command line, although that is planned for
a future release.
golistdepgraph uses a simple color scheme to denote different types of packages:
- green: a package that is part of the Go standard library, installed in
$GOROOT
. - blue: a regular Go package found in
$GOPATH
. - orange: a package found in
$GOPATH
that uses cgo by importing the special package "C".
The above list of colors is incorrect!!!
golistdepgraph uses a simple color scheme to denote different types of states packages, by font color:
- red: an incomplete package that had an error in at least one dependency (e.g., missing source code).
- blue: a stale package whose sources are not up-to-date with its binary.
- black: no errors and up-to-date.