go callvis
v0.7.0
Go-Callvis是一种开发工具,可帮助可视化使用Interactive视图的GO程序的呼叫图。
该工具的目的是使用Call Graph及其与软件包和类型的关系为开发人员提供GO程序的视觉概述。这在较大的项目中特别有用,因为代码的复杂性更高,或者只是只是试图了解别人的代码。

查看上图的源代码。
它运行指针分析以构建程序的呼叫图,并使用数据以DOT格式生成输出,可以使用GraphViz工具渲染。
-graphviz标志)要安装Go-Callvis,请运行:
# Latest release
go install github.com/ofabry/go-callvis@latest
# Development version
go install github.com/ofabry/go-callvis@master或者,克隆存储库并编译源代码:
# Clone repository
git clone https://github.com/ofabry/go-callvis.git
cd go-callvis
# Compile and install
make install要使用为专注软件包的SVG图像提供的Web服务器提供的交互式视图,您可以简单地运行:
go-callvis <target package>
http服务器正在http:// localhost:7878/默认情况下侦听,使用选项-http="ADDR:PORT"以更改http服务器地址。
要生成一个单个输出文件使用选项-file=<file path>选择输出文件目标。
输出格式默认为svg ,使用选项-format=<svg|png|jpg|...>选择其他输出格式。
Usage of go-callvis:
-debug
Enable verbose log.
-file string
output filename - omit to use server mode
-cacheDir string
Enable caching to avoid unnecessary re-rendering.
-focus string
Focus specific package using name or import path. (default "main")
-format string
output file format [svg | png | jpg | ...] (default "svg")
-graphviz
Use Graphviz's dot program to render images.
-group string
Grouping functions by packages and/or types [pkg, type] (separated by comma) (default "pkg")
-http string
HTTP service address. (default ":7878")
-ignore string
Ignore package paths containing given prefixes (separated by comma)
-include string
Include package paths with given prefixes (separated by comma)
-limit string
Limit package paths to given prefixes (separated by comma)
-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)
-nointer
Omit calls to unexported functions.
-nostd
Omit calls to/from packages in standard library.
-rankdir
Direction of graph layout [LR | RL | TB | BT] (default "LR")
-skipbrowser
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
-tests
Include test code.
-version
Show version and exit.
运行go-callvis -h列出所有受支持的选项。
在这里,您可以找到各种输出的描述。
| 代表 | 风格 |
|---|---|
focused | 蓝色 |
stdlib | 绿色 |
other | 黄色 |
| 代表 | 风格 |
|---|---|
exported | 大胆的边界 |
unexported | 正常边界 |
anonymous | 虚线边界 |
| 代表 | 风格 |
|---|---|
internal | 黑色 |
external | 棕色 |
static | 实线 |
dynamic | 虚线 |
regular | 简单的箭头 |
concurrent | 带有圆圈的箭头 |
deferred | 用钻石箭 |
这是项目同步的示例。

查看更多示例和使用的命令选项。
加入gophers.slack.com的#go-callvis频道。 (还不是会员?获取邀请)
您是否找到了任何错误或有一些建议?
您想为该项目做出贡献吗?
该项目的理想目标是制作可以在本地存储呼叫图数据的Web应用程序,然后为您的依赖关系树的任何包装提供快速访问呼叫图。首先,它将显示软件包之间整体依赖关系的交互式图,然后选择特定的软件包,它将显示呼叫图并提供各种选项以动态更改输出。