GoLand中使用PlantUML生成Go UML图,使用go-callvis生成Go 调用关系图

发布时间 2023-07-17 09:25:08作者: 易先讯

1.在goland IDE中安装plantuml插件

2.安装go-package-plantuml工具
go get --insecure gitee.com/jscode/go-package-plantuml.git

修改go-package-plantuml代码支持outputfile
if opts.OutputFile==""{
result.OutputToFile("/tmp/uml.txt")
}else{
result.OutputToFile(opts.OutputFile)
}
go build 生成go-package-plantuml可执行文件

3.在goland中settings-->tools-->external tools配置gotouml
/root/networkservicemesh/gobuild/gocode/src/gitee.com/jscode/go-package-plantuml/go-package-plantuml
--gopath $GOPATH$ --codedir $FileDir$ --outputfile $FileDir$.puml


4.安装go-callvis
go get -u github.com/TrueFurby/go-callvis
go build 生成go-callvis可执行文件

go-callvis测试:
./go-callvis -debug -nostd github.com/networkservicemesh/networkservicemesh/k8s/cmd/nsmd-k8s | dot -Tsvg -o mgr.svg、
./go-callvis -debug -nostd -group pkg,type --focus dataplane -limit github.com/networkservicemesh/networkservicemesh github.com/networkservicemesh/networkservicemesh/dataplane/vppagent/cmd1.在goland IDE中安装plantuml插件

2.安装go-package-plantuml工具
go get --insecure gitee.com/jscode/go-package-plantuml.git

修改go-package-plantuml代码支持outputfile
if opts.OutputFile==""{
result.OutputToFile("/tmp/uml.txt")
}else{
result.OutputToFile(opts.OutputFile)
}
go build 生成go-package-plantuml可执行文件

3.在goland中settings-->tools-->external tools配置gotouml
/root/networkservicemesh/gobuild/gocode/src/gitee.com/jscode/go-package-plantuml/go-package-plantuml
--gopath $GOPATH$ --codedir $FileDir$ --outputfile $FileDir$.puml


4.安装go-callvis
go get -u github.com/TrueFurby/go-callvis
go build 生成go-callvis可执行文件

go-callvis测试:
./go-callvis -debug -nostd github.com/networkservicemesh/networkservicemesh/k8s/cmd/nsmd-k8s | dot -Tsvg -o mgr.svg、
./go-callvis -debug -nostd -group pkg,type --focus dataplane -limit github.com/networkservicemesh/networkservicemesh github.com/networkservicemesh/networkservicemesh/dataplane/vppagent/cmd