internal/shape/shape.go
Ref: Size: 1.2 KiB History
// Package shape generates an explorable diagram of eitri's package graph from
// the real `go list` output, so the architecture view cannot silently drift
// from the code.
package shape
// Plane is the architectural group a package belongs to.
type Plane string
const (
PlaneControl Plane = "control"
PlaneData Plane = "data"
PlaneWire Plane = "wire"
PlaneBinaries Plane = "binaries"
PlaneTooling Plane = "tooling"
PlaneUnclassified Plane = "unclassified"
)
// module is the import-path prefix shared by every package in this repo.
const module = "github.com/a73x/eitri"
// rawPackage is the subset of `go list -json` fields the generator consumes.
type rawPackage struct {
ImportPath string
Doc string
Imports []string
}
// Package is one node in the shape graph. All string fields are module-relative.
type Package struct {
ImportPath string `json:"importPath"`
Plane Plane `json:"plane"`
Synopsis string `json:"synopsis"`
Imports []string `json:"imports"` // internal (production) imports, sorted
}
// Model is the full, deterministic shape graph.
type Model struct {
Module string `json:"module"`
Packages []Package `json:"packages"` // sorted by ImportPath
}