build

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package build assembles a graph.Graph from analyzer results, extracted routes and a layer classifier. It selects the nodes worth showing (endpoints plus functions in classified layers), then derives call edges between them — collapsing through unclassified helper functions so a controller still links to a service even when a thin wrapper sits in between.

When ports are enabled, outbound interface ports (interfaces implemented by a repository-layer type) become first-class nodes: the direct service -> repository call is replaced by service -> port (uses) and repository -> port (implements), surfacing the hexagonal seam.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Graph

func Graph(res *analyzer.Result, routes []route.Route, cl *classify.Classifier, opts Options) graph.Graph

Graph builds the architecture graph per opts.

Types

type Options

type Options struct {
	Editor      string
	ShowPorts   bool
	DetectBuses bool
	// ShowHelpers keeps trivial helper functions (unexported free functions in a
	// classified layer) as nodes. When false (default) they are collapsed
	// through, so a caller still links to what the helper reaches.
	ShowHelpers bool
	// AutoLayer infers a layer for functions reached from an endpoint whose
	// package name doesn't match a layer keyword: the entry is a controller, a
	// function that calls further into the app is a service, and a sink (one
	// that only reaches external/leaf code) is a repository. This makes archview
	// work on any layout without per-project keyword config. Keyword
	// classification still wins where it applies.
	AutoLayer bool
	// LintLayers flags architecture smells on call edges (reverse dependencies,
	// controller bypassing the service layer, cross-module calls).
	LintLayers bool
	// SystemView turns on the microservice view: each cmd/<x> entrypoint is a
	// service, every function is assigned to the service(s) whose main reaches
	// it, and cross-service calls over the wire (gRPC today) are stitched as rpc
	// edges. Modules become services so the UI lanes by service.
	SystemView bool
	// Raw emits the full structural graph for external consumers (e.g.
	// arch-diff): every project function as a node, every static call edge, and
	// classified layers — with no pruning, no helper collapse, and no
	// endpoint-reachability filter. A node absent from the pruned UI graph
	// (orphaned, dead) is exactly what dead-code analysis needs, so Raw keeps it.
	Raw bool
}

Options controls how the graph is assembled.

Jump to

Keyboard shortcuts

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