Skip to content

Analysis and class diagram generation for Golang Projects with plantuml

License

Notifications You must be signed in to change notification settings

ahilbig/go-package-plantuml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-package-plantuml

Environmental configuration

1.Install go environment and configure environment variables

export GOROOT=/opt/golang/go
export PATH=$GOROOT/bin:$PATH
export GOPATH=/opt/gopath

2.Install JDK8 and configure environment variables

export JAVA_HOME=/opt/jdk/jdk1.8.0_161
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

in /etc/profile --> Add the corresponding environment variable to the file and refresh with source /etc/profile

Install required software

yum install graphviz
yum install git
yum install wget

Download and compile the project

go get github.com/ahilbig/go-package-plantuml

Compiling and downloading dependencies

First run automatically downloads dependencies, please wait patiently

cd /opt
cp $GOPATH/src/github.com/maobuji/go-package-plantuml/goplantuml . -rf
cd goplantuml
chmod 775 *.sh
sh install.sh

Run directly using commands

Direct operation can set more parameters, --codedir must be entered, other parameters are optional

./go-package-plantuml --codedir /appdev/gopath/src/github.com/contiv/netplugin \
--gopath /appdev/gopath \
--outputfile  /tmp/result.txt
--ignoredir /appdev/gopath/src/github.com/contiv/netplugin/vendor

Parameter Description
--codedir The code directory to analyze
--gopath GOPATH Environment variable directory
--outputfile Analysis results are saved to this file
--ignoredir No need for code analysis directory(Can not set)
--ignorefile, -if No need for code analysis
--file, -f Include file - all other will be ignored --replacetag, -r Mark and (if file exists replace) UML section with comment containing this tag

if --replacetag or -r is specified the UML will be framed by comments containing this tag.< Subsequent calls of the analysis will replace just this section if present instead of overwriting the file. This can be used for automatically generating UML snippets during CI/CD Pipelines for a project and embedding them into markdown containing other contents e.g. readme.md

The output text of the previous step, convert to svg file

java -jar plantuml.jar /tmp/result.txt -tsvg

gouml Samples in the script, can be directly run by sh gouml.sh

About

Analysis and class diagram generation for Golang Projects with plantuml

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.9%
  • Shell 4.1%