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
Check out the source code for the above image.
It runs pointer analysis to construct the call graph of the program and uses the data to generate output in dot format, which can be rendered with Graphviz tools.
Here you can find descriptions for all possible kinds of calls and groups.
Packages
- normal corners
- label on the top
Types
- rounded corners
- label on the bottom
Represents | Style |
---|---|
focused |
blue color |
stdlib |
green color |
`other` | _**yellow** color_
Represents | Style |
---|---|
exported |
bold border |
unexported |
normal border |
anonymous |
dotted border |
Represents | Style |
---|---|
internal |
black color |
external |
brown color |
`static` | _**solid** line_
dynamic
| dashed line
regular
| simple arrow
concurrent
| arrow with circle
deferred
| arrow with diamond
go get -u github.com/TrueFurby/go-callvis
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.
Join #go-callvis channel at gophers.slack.com.
Not a member yet? Get invitation.
Feel free to open new issue or start discussion in the slack channel.
Fork the project and do a pull request. Here you can find the state of features.
- 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 goexplorer! 💥
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.