LoginSignup
0
0

More than 1 year has passed since last update.

Goコードのクラス図をPlantUMLファイルとして自動生成する

Posted at

Goコードのクラス図をPlantUMLファイルとして自動生成する (Goにはクラスはないため、正確には「structの関係図をクラス図として表現したもの」である)。

環境

  • Ubuntu 20.04 LTS (WSL2)
  • Go 1.19.3

Goはインストール済みであるとする。

ツールのインストール

# goplantumlのインストール
go install github.com/jfeliu007/goplantuml/cmd/goplantuml@latest

手順

# クラス定義作成対象のコードを準備 (ここでは、goplantuml自体を利用)
git clone https://github.com/jfeliu007/goplantuml.git input 

# plantuml用のファイルを生成
goplantuml -recursive ./input/parser > ./parser.puml

ここまでで、parser.pumlとしてPlantUMLのファイルが生成できた。

PlantUMLのファイルをクラス図として描画する

簡単には、以下のような公式のWeb Serverを使うことでクラス図の画像にすることができる。

また、Visual Studio CodeのPlantUML拡張機能を利用することでプレビューすることもできる。

以上

参考

go のプロジェクトでクラス図を生成する

jfeliu007/goplantuml

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0