go-callvis is a development tool to help visualize call graph of your Go program using Graphviz's dot format.
Purpose of this tool is to provide a visual overview of your program by using the data from call graph and its relations with packages and types. This is especially useful in larger projects where the complexity of the code rises or when you are just simply trying to understand code structure of somebody else.
- focus specific package in a program
- group functions by package and methods by type
- limit packages to custom path prefixes
- ignore packages containing path prefixes
- omit calls from/to std packages
Check out the source code for the above image.
How it works
Here you can find descriptions for all possible kinds of calls and groups.
Packages / Types
Represented as subgraphs (clusters) in output.
- normal corners
- label on the top
- rounded corners
- label on the bottom
Functions / Methods
Represented as nodes in output.
Represented as edges in output.
||arrow with circle|
||arrow with diamond|
go get -u github.com/TrueFurby/go-callvis cd $GOPATH/src/github.com/TrueFurby/go-callvis && make
go-callvis [OPTIONS] <main pkg> | dot -Tpng -o output.png
-focus string Focus package with import path or name. (default: main) -limit string Limit package paths to prefix. (separate multiple by comma) -group string Grouping functions by [pkg, type]. (separate multiple by comma) -ignore string Ignore package paths with prefix. (separate multiple by comma) -nostd Omit calls from/to std packages. -minlen uint Minimum edge length (for wider output). (default: 2) -nodesep float Minimum space between two adjacent nodes in the same rank (for taller output). (default: 0.35)
Here is an example for the project syncthing.
Check out more examples and used command options.
Not a member yet? Get invitation.
How to help
Did you find any bugs or have some suggestions?
Feel free to open new issue or start discussion in the slack channel.
Do you want to contribute to the development?
Fork the project and do a pull request. Here you can find the state of features.
Each execution takes a lot of time, because currently:
- the call graph is always generated for the entire program
- there is yet no caching of call graph data
The interactive tool described below has been published as a separate project called
Ideal goal of this project is to make web app that would locally store the call graph data and then provide quick access of the call graphs for any package of your dependency tree. At first it would show an interactive map of overall dependencies between packages and then by selecting particular package it would show the call graph and provide various options to alter the output dynamically.