Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

pehrs/go2dot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go2dot

A utility to generate a Graphviz dot graph for a golang package structures and functions.

Example:

graph example

Requirements

You need the following installed and in your path:

Install

Please use resent version of dot/graphviz.

#install dot
brew install graphviz

# Install golang
asdf install golang $(cat .tool-versions | grep "golang" | cut -d" " -f2)

git clone [email protected]:pehrs/go2dot.git
cd ./go2dot
make

export PATH=/path/to/go2dot/bin:$PATH

Usage

Generate DOT

# Generate DOT file for a package (including private functions and structs)
go2dot dot --private ./pkg/golang/ > samples/graph.dot 

# Generate PNG
dot -Tpng samples/graph.dot -o samples/test-pkg-golang.png

Generate image

# Generate high quality PNG with custom fonts
go2dot graph -Tpng -p ./pkg/golang/ samples/test-pkg-golang.png \
    -x '-Gfontname="Ubuntu Mono" -Nfontname="Ubuntu Mono" -Gsize=4,3 -Gdpi=1000'

Known Issues

  • We have not tested go expressions to the full yet. The ./samples/sample.go file is used to represent a "typical" golang source for functional testing.

  • dot does not generate SVG very well.

Release Notes

1.0.0

Initial release

About

Generate graph of your golang source structs and functions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published