Skip to content

Latest commit

 

History

History
93 lines (74 loc) · 1.77 KB

README.md

File metadata and controls

93 lines (74 loc) · 1.77 KB

go-dependency-graph

Purpose of this tool is to provide a visual dependency overview of your program.

Required For Visual

sudo apt-get install graphviz

Install

go get github.com/tanmoyopenroot/go-dependency-graph

Command-Line

Simply execute main.go with one or more package names to visualize.

$ go run main.go const.go dot-graph.go generate-dependency-graph.go show-dependency-tree.go dot-template.go -show-std=true strings
Arguments:  [strings]
strings
 ├ errors
 ├ io
   ├ errors
   └ sync
     ├ internal/race
       └ unsafe
     ├ runtime
       ├ runtime/internal/atomic
         └ unsafe
       ├ runtime/internal/sys
       └ unsafe
     ├ sync/atomic
       └ unsafe
     └ unsafe
 ├ unicode
 └ unicode/utf8

This generates a Graphviz's dot format file, to view execute the following:

$ dot -Tpng strings.dot -o strings.png
$ eog strings.png

picture

-level and -show-std

Decide your dependency graph level and also choose whether to show standard library.

go run main.go const.go dot-graph.go generate-dependency-graph.go show-dependency-tree.go dot-template.go -show-std=true -level=1 fmt
Arguments:  [fmt]
fmt
 ├ errors
 ├ io
 ├ math
 ├ os
 ├ reflect
 ├ strconv
 ├ sync
 └ unicode/utf8

picture

-ignore

Remove packages from your dependency graph.

go run main.go const.go dot-graph.go generate-dependency-graph.go show-dependency-tree.go dot-template.go -show-std=true -ignore=sync,reflect,os fmt
Arguments:  [fmt]
fmt
 ├ errors
 ├ io
   ├ errors
 ├ math
   └ unsafe
 ├ strconv
   ├ errors
   ├ math
     └ unsafe
   └ unicode/utf8
 └ unicode/utf8

picture