golangA problem was that the dependent package version was clearly specified, and the version number was automatically raised during construction. I didn’t know why at that time. I know there’s one in the back
go mod graphThe command can list all dependencies. After trying, it is not intuitive at all. It has to be copied to the text editor to retrieve information.
So I checked the relevant tools on the Internet.
Retrieve go module dependency visualization
There are still many tools on the Internet. Most of the options are
echart, or draw pictures, I tried a few.
graphvizThis tool is very powerful, but it needs to be installed through other channels, and the generated SVG is not so readable, especially after there are more dependent packages, such as the following:
So I turned to echart,
Wow, it looks good, the mouse hover feedback is also good, and the color matching is also very bright.
The echart scheme is beautiful, but it doesn’t work. Svg I can also search the package name, but echart does not display the package name.
OK, make complaints about Tucao make complaints about it. Today I’d like to introduce you to
go mod graphVisualization tools——gmchart
go get -u github.com/PaulXu-cn/go-mod-graph-chart/gmchart
Check the installation. The following is the success
gmchart --help Usage of ~\go\bin\gmchart: -debug int is debug model -keep int start http server not exit
Enter the golang project and enter the command:
go mod graph | gmchart
The browser will be opened automatically. If not, just manually
You can see that it forms a dependency tree. You can know which layer of a package is introduced, which is very intuitive. The web page is an SVG. It’s also very convenient for you to find a package
ctr+FYou can retrieve it.
After looking for so long, why don’t you have a tool?
I thought,visualizationThe front-end is good at it. The front-end doesn’t need it
golangAh, there are few, yes
GolangThe front end of the is also right
go mod graphWe are less interested in this function, so this tool can only be done by our back-end
This work adoptsCC agreement, reprint must indicate the author and the link to this article