Skip to content

Rework of godepgraph using execing "go list -json" to gather info about packages

License

Notifications You must be signed in to change notification settings

paulbuis/golistdepgraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golistdepgraph

Rework of godepgraph using execing go list -json to gather info about packages.

Install

go get github.com/paulbuis/golistdepgraph

Use

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.

Ignoring Imports

The Go Standard Library

If you want to ignore standard library packages entirely, use the -s flag:

golistdepgraph -s github.com/paulbuis/golistdepgraph

3 By Name

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.

By Prefix

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

Delving into internals of GOROOT packages

golistdepgraph -d github.com/paulbuis/golistdepgraph

Including test packages

golistdepgraph -t github.com/paulbuis/golistdepgraph

Build tags

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.

Output

Node Background Fill Colors

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!!!

Node Label Font Colors

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.

About

Rework of godepgraph using execing "go list -json" to gather info about packages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages