Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kisielk/godepgraph
A Go dependency graph visualization tool
https://github.com/kisielk/godepgraph
Last synced: 1 day ago
JSON representation
A Go dependency graph visualization tool
- Host: GitHub
- URL: https://github.com/kisielk/godepgraph
- Owner: kisielk
- License: mit
- Created: 2013-02-13T22:29:38.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T16:05:02.000Z (10 months ago)
- Last Synced: 2025-01-17T22:05:38.049Z (8 days ago)
- Language: Go
- Size: 2.07 MB
- Stars: 1,074
- Watchers: 15
- Forks: 93
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome - kisielk/godepgraph - 04 star:1.1k fork:0.1k A Go dependency graph visualization tool (Go)
README
# godepgraph
godepgraph is a program for generating a dependency graph of Go packages.
[![Build Status](https://travis-ci.org/kisielk/godepgraph.png?branch=master)](https://travis-ci.org/kisielk/godepgraph)
## Install
go install github.com/kisielk/godepgraph@latest
## Use
For basic usage, just give the package path of interest as the first
argument:godepgraph github.com/kisielk/godepgraph
If you intent to graph a go mod project, your package should be passed as a relative path:godepgraph ./pkg/api
The output is a graph in [Graphviz][graphviz] dot format. If you have the
graphviz tools installed you can render it by piping the output to dot:godepgraph github.com/kisielk/godepgraph | dot -Tpng -o godepgraph.png
By default godepgraph will display packages in the standard library in the
graph, though it will not delve in to their dependencies.## Colors
godepgraph 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`.
* *yellow*: a vendored Go package found in `$GOPATH`.
* *orange*: a package found in `$GOPATH` that uses cgo by importing the special package "C".## Ignoring Imports
### The Go Standard Library
If you want to ignore standard library packages entirely, use the -s flag:
godepgraph -s github.com/kisielk/godepgraph
### Vendored Libraries
If you want to ignore vendored packages entirely, use the -novendor flag:
godepgraph -novendor github.com/something/else
### By Name
Import paths can be ignored in a comma-separated list passed to the -i flag:
godepgraph -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:godepgraph -p github.com,launchpad.net bitbucket.org/foo/bar
## Example
Here's some example output for godepgraph itself:
![Example output](example.png)
[graphviz]: http://graphviz.org