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
yum install graphviz
yum install git
yum install wget
go get github.com/ahilbig/go-package-plantuml
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
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