go-callvis is a development tool to help visualize call graph of a Go program using interactive view.
---
## Introduction
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.
### Features
- 🆕 **support for Go modules!** :boom:
- focus specific package in the program
- click on package to quickly switch the focus using [interactive viewer](#interactive-viewer)
- group functions by package and/or methods by type
- filter packages to specific import path prefixes
- ignore funcs from standard library
- omit various types of function calls
### Output preview
[](https://raw.githubusercontent.com/ofabry/go-callvis/master/images/main.png)
> Check out the [source code](examples/main) for the above image.
### How it works
It runs [pointer analysis](https://godoc.org/golang.org/x/tools/go/pointer) to construct the call graph of the program and
uses the data to generate output in [dot format](http://www.graphviz.org/content/dot-language), which can be rendered with Graphviz tools.
## Reference guide
Here you can find descriptions for various types of output.
### Packages / Types
|Represents | Style|
|----------: | :-------------|
|`focused` | **blue** color|
|`stdlib` | **green** color|
|`other` | **yellow** color|
### Functions / Methods
|Represents | Style|
|-----------: | :--------------|
|`exported` | **bold** border|
|`unexported` | **normal** border|
|`anonymous` | **dotted** border|
### Calls
|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**|
## Quick start
#### Requirements
- [Go](https://golang.org/dl/) 1.13+
- [Graphviz](http://www.graphviz.org/download/) (optional, required only with `-graphviz` flag)
### Installation
```sh
go get -u github.com/ofabry/go-callvis
# or
git clone https://github.com/ofabry/go-callvis.git
cd go-callvis && make install
```
### Usage
#### Interactive viewer
To use the interactive view provided by a web server that serves SVG images of focused packages, you can simply run:
`go-callvis `
HTTP server is listening on [http://localhost:7878/](http://localhost:7878/) by default, use option `-http="ADDR:PORT"` to change HTTP server address.
#### Render static output
To generate a single output file use option `-file=` to choose output file destination.
The output format defaults to `svg`, use option `-format=