Documentation
¶
Overview ¶
Command check-layers verifies the layered architecture. It enforces:
- P1 — strict downward imports: every Go import must target a layer ≤ source layer - 1.
- P2 — single upward interface per layer: when a destination layer declares `public:` in layers.yaml, cross-layer imports may only target one of those packages; sibling packages listed in `packages:` but absent from `public:` are layer-internal.
- P5 — tests stay within their layer (when --tests is passed).
Reads layers.yaml from the repo root, runs `go list -json ./...`, walks the import graph, and exits non-zero on any forbidden edge.
Known transitional violations (listed under known_transitional in layers.yaml) are reported as warnings, not failures, so the build stays green during the simplification work even though violations exist.
Usage:
go run ./tools/check-layers ./... — non-test imports only go run ./tools/check-layers --tests ./... — also walk TestImports + XTestImports (P5)
See docs/architecture/05-VERIFICATION.md for the verification framework this is part of.
Click to show internal directories.
Click to hide internal directories.