Documentation
¶
Overview ¶
Package layout builds repository import graphs for dependency-boundary tests.
Design ¶
LoadRepo reads both Go modules, records package edges and maps them to repository-relative paths. The graph supports transitive reachability and directory-level strongly connected components. Tests define tier rules and their explicit exceptions.
Keeping the graph reader separate from policy lets the tests verify package placement and module direction. The lint workflow reports issues without a failing issue exit code, so these boundaries are enforced through Go tests.
References ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrGoList = fmt.Errorf("layout: go list failed")
ErrGoList reports that the go command could not enumerate the module.
Functions ¶
Types ¶
type Graph ¶
type Graph struct {
Module string
Imports map[string][]string
// External records imports outside this module, which LoadRepo needs to
// resolve edges from the server module back into the library.
External map[string][]string
}
Graph is this module's package import graph, keyed by package path relative to the module path ("mdm", "ddm/predicate"). Only in-module imports are recorded; the standard library and third-party dependencies are not part of a tier question.
func LoadRepo ¶
LoadRepo returns one graph spanning every module in the repository. The server is its own module, so a single go list would stop at the library and the tier tests would quietly cover half the tree. Server packages keep their directory as a prefix ("server/service"), so a package's key is its path from the repository root either way.