Analysis Go Project source code, using PLANTUML to generate UML class diagram automatically

Source: Internet
Author: User
Tags plantuml
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.