Visualize Go dependency in Graphviz DOT format.
Support visualize package from https://pkg.go.dev
$ go get github.com/chuongtrh/godepviz
$ godepviz github.com/gofiber/fiber/v2
The output is a graph in Graphviz dot format.
digraph G {
rankdir="LR";
pad=.25;
ratio=fill;
dpi=360;
node [shape=box];
"github.com/gofiber/fiber/v2" -> "github.com/valyala/fasthttp";
"github.com/valyala/fasthttp" -> "github.com/andybalholm/brotli";
"github.com/valyala/fasthttp" -> "github.com/klauspost/compress/flate";
"github.com/valyala/fasthttp" -> "github.com/klauspost/compress/gzip";
"github.com/valyala/fasthttp" -> "github.com/klauspost/compress/zlib";
"github.com/valyala/fasthttp" -> "github.com/valyala/bytebufferpool";
"github.com/gofiber/fiber/v2" -> "github.com/valyala/fasthttp/reuseport";
"github.com/valyala/fasthttp/reuseport" -> "github.com/valyala/tcplisten";
"github.com/gofiber/fiber/v2" [style=filled];
}
You can view a output graph with tool https://dreampuf.github.io/GraphvizOnline or http://viz-js.com
If you have the graphviz tools installed you can render it by piping the output to dot:
$ godepviz github.com/gofiber/fiber/v2 | dot -Tpng -o godep.png
Export SVG file with a large graph have many nodes of dependencies
$ godepviz github.com/gofiber/fiber/v2 | dot -Gdpi=0 -T svg -o godep.svg
Run from source code
$ go run main.go go.uber.org/zap | dot -Tpng -o godep.png
- Package
net/http
- Package
github.com/labstack/echo/v4
- Package
github.com/gofiber/fiber/v2
MIT