Skip to content

godepsresolve/dep_graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go dependencies analyze

There could be an issue with rich dependency tree in some Go project. So it's worth having some tools to analyze them.

Two different tools are described here, they could be installed with make tools command.

Analyze of regular dependency resolving

Analyze with gomod

Project is here. Let's analyze mainservice, run:

$ git clone [email protected]:godepsresolve/mainservice.git
$ cd mainservice
$ gomod graph -a '**' | dot -Tsvg -o graph.svg

Then open graph.svg with your favorite image viewer. gomod graph image

You can also run gomod only for your dependencies, because in large projects with many dependencies graph becomes unreadable: $ gomod graph -a 'github.com/godepsresolve/**' | dot -Tsvg -o graph.svg.

Analyze with modgraphviz

Project is here. Let's analyze mainservice, run:

$ git clone [email protected]:godepsresolve/mainservice.git
$ cd mainservice
$ go mod graph | modgraphviz | dot -Tsvg -o graph_modg.svg

Then open graph.svg with your favorite image viewer. modgraphviz graph image

As for only required group of dependency you can grep them before processing (space before github.com is not a typo): go mod graph | grep ' github.com' | modgraphviz | dot -Tsvg -o graph_modg.svg.

Analyze of dependency resolving with replaces

Analyze with gomod

Let's analyze mainservice_replace_fork, run:

$ git clone [email protected]:godepsresolve/mainservice_replace_fork.git
$ cd mainservice_replace_fork
$ gomod graph -a '**' | dot -Tsvg -o graph.svg

Then open graph.svg with your favorite image viewer. gomod graph image

Analyze with modgraphviz

Let's analyze mainservice_replace_fork, run:

$ git clone [email protected]:godepsresolve/mainservice_replace_fork.git
$ cd mainservice_replace_fork
$ go mod graph | modgraphviz | dot -Tsvg -o graph_modg.svg

Then open graph.svg with your favorite image viewer. modgraphviz graph image

As you can see modgrapviz method is useless here, because go mod graph does not consider replace directive. So I cannot recommend go mod graph with modgraphviz in case with replace.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published