archview

command module
v0.0.0-...-fceed96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

ArchView

ArchView is a tool for creating and inspecting Go program architecture based on annotations.

Introduction

To start using, add annotations like so:

// architecture: Database
type DB interface {
	Query() string
}

// architecture: Service
type Users struct {
	db       *DB
	comments *Comments
}

// architecture: Service
type Comments struct {
	db    *DB
	users *Users
}

// architecture: Server
type Server struct {
	comments *Comments
	users    *Users
}

// we can create links between interfaces and implementations with idiomatic Go
var _ DB = &PostgresDB{}
var _ DB = (*SqliteDB)(nil)

// architecture: Database Implementation
type PostgresDB struct{}

// architecture: Database Implementation
type SqliteDB struct{}

When we run the tool to output a graphviz dot file:

archview ./... | dot -Tsvg > graph.svg

Basic Diagram

We can also use more complicated tools, by outputting a graphml file:

archview -out example.graphml ./... 

With a tool like yEd we can try different ways of visualizing:

Prettier Diagram

Install

To install archview run:

go install github.com/storj/archview@latest

You'll also need a tool to layout the graph, for example:

  1. GraphViz for dot formats.
  2. yEd for graphml formats.

Running the tool outputs the graph definition:

archview [-format (dot|dot-basic|graphml)] [-out <output file>] [packages]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package arch implements gathering component information and links.
Package arch implements gathering component information and links.
Package edit implements different arch graph utilities.
Package edit implements different arch graph utilities.
Package graph implements different graph output formats.
Package graph implements different graph output formats.
graphml
Package graphml contains XML definitions for graphml format.
Package graphml contains XML definitions for graphml format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL