go-plantuml

go-plantuml generates plantuml diagrams from go source files or directories.

Installation

go get -u github.com/bykof/go-plantuml

Please consider that $GOPATH/bin should be on our $PATH.

Usage

Usage:
  go-plantuml [command]

Available Commands:
  generate    Generate a plantuml diagram from given paths
  help        Help about any command

Flags:
  -h, --help     help for go-plantuml
  -t, --toggle   Help message for toggle

Use "go-plantuml [command] --help" for more information about a command.


Usage:
  go-plantuml generate [flags]

Flags:
  -d, --directories strings   the go source directories (default [.])
  -f, --files strings         the go source files
  -h, --help                  help for generate
  -o, --out string            the graphfile (default "graph.puml")
  -r, --recursive             traverse the given directories recursively

Example

For example we have to files in the directory testGraph.

// address.go
package testGraph

type (
	Address struct {
		Street     string
		City       string
		PostalCode string
		Country    string
	}
)

func (address Address) FullAddress(withPostalCode bool) string {
    return ""
}

// user.go
package testGraph

type (
	User struct {
		FirstName      string
		LastName       string
		age            uint8
		Address        Address
		privateAddress Address
	}
)

func (user *User) SetFirstName(firstName string) {}

Then we run go-plantuml generate or go-plantuml generate -d . -o graph.puml.

This will create a graph.puml file and check for .go files inside your current directory.

Which looks like this:

GitHub