go-callvis is a development tool to help visualize call graph of a Go program using interactive view.
The purpose of this tool is to provide developers with a visual overview of a Go program using data from call graph and its relations with packages and types. This is especially useful in larger projects where the complexity of the code much higher or when you are just simply trying to understand code of somebody else.
- 💥 support for Go modules! 🆕
- interactive view allowing quick switching between focused packages in web browser
- focus specific package in the program
- group functions by package and/or methods by type
- filter packages to specific import path prefixes
- omit various types of function calls
Check out the source code for the above image.
How it works
Here you can find descriptions for various types of output.
Packages / Types
Functions / Methods
|arrow with circle
|arrow with diamond
go get -u github.com/TrueFurby/go-callvis
git clone https://github.com/TrueFurby/go-callvis.git
cd go-callvis && make install
To use the interactive view provided by a web server that serves SVG images of focused packages, you can simply run:
go-callvis [OPTIONS] <main package>
HTTP server is listening on http://localhost:7878/ by default.
To generate a single output file use option
-file=<file path> to choose output file destination. The output format defaults to
svg, use option
-format=<svg|png|jpg|...> to pick a different output format.
Usage of go-callvis:
Enable verbose log.
output filename - omit to use server mode
Focus specific package using name or import path. (default "main")
output file format [svg | png | jpg | ...] (default "svg")
Grouping functions by packages and/or types [pkg, type] (separated by comma)
HTTP service address. (default ":7878")
Ignore package paths containing given prefixes (separated by comma)
Include package paths with given prefixes (separated by comma)
Limit package paths to given prefixes (separated by comma)
Omit calls to unexported functions.
Omit calls to/from packages in standard library.
Skip opening browser.
-tags build tags
a list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package
Include test code.
Show version and exit.
go-callvis -h to list all supported options.
Here is an example for the project syncthing.
Check out more examples and used command options.
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 project?
- Fork the repository and open a pull request. Here you can find TODO features.
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.