This is a creation in Article, where the information may have evolved or changed.
Using tool GO-PACKAGE-PLANTUML to analyze the source code of Go project, generate UML class diagram automatically
PLANTUML Tools Introduction
PLANTUML supports converting "text-describing UML class diagrams" to class diagrams in picture form.
Examples of class diagrams use are as follows, refer to Http://plantuml.com/class-diagram
@startumlClass11 <|. CLASS12CLASS13-CLASS14@ENDUML
Installing GO-PACKAGE-PLANTUML
GO-PACKAGE-PLANTUML Project code address HTTPS://GIT.OSCHINA.NET/JSCODE/GO-PACKAGE-PLANTUML
Download and compile the project: (The system needs to install the Go compilation environment first)
go get git.oschina.net/jscode/go-package-plantumlgo build git.oschina.net/jscode/go-package-plantuml
Use GO-PACKAGE-PLANTUML to parse the GO project to generate a UML class diagram description file
./go-package-plantuml --codedir /appdev/gopath/src/github.com/contiv/netplugin \--gopath /appdev/gopath \--outputfile /tmp/result \--ignoredir /appdev/gopath/src/github.com/contiv/netplugin/vendor参数说明--codedir 要分析的代码目录--gopath GOPATH环境变量目录--outputfile 分析结果保存到该文件--ignoredir 不需要进行代码分析的目录(可以不用设置)
Generating class diagrams using PLANTUML
Download Plantuml Https://nchc.dl.sourceforge.net/project/plantuml/plantuml.jar
Tip: If the system does not have a JDK installed, you need to first install Jdk;yum install-y java
Execute the following command to generate a class diagram in the form of a picture/tmp/uml.png
java -jar plantuml.jar /tmp/text.uml
If you want to generate a file in SVG format, use the-tsvg parameter. SVG formatted files, opened with a browser, can search for class names.
java -jar plantuml.jar /tmp/text.uml -tsvg