Expand description
The triplet interpreter (item 3) — apply(env, ctx) -> BuildSpec.
Walks the encoder phases over go list -deps -json output:
read-go-mod → go-list → parse-go-list → reject-cgo + reject-asm (Go-I12)
→ per-node: relative-path (Go-I3) → read-source + source_hash (Go-I8)
→ resolve-imports (Go-I1) → embed (Go-I9) → tree (Go-I2)
→ roots/members → compact target_resolves → go_sum tie (Go-I7)Every side effect — the go list subprocess AND source-file reads —
is abstracted behind the GoBuildEnv trait, so the whole encoder
is driven by a MockGoBuildEnv in unit tests with ZERO
go / filesystem dependency. The trait IS the testability contract
(TYPED-SPEC + INTERPRETER TRIPLET). A phase that cannot complete
returns a typed GomodError::Interp naming the phase — never a
silent wrong answer, never a panic!.
Structs§
- Encode
Ctx - Encoder inputs: the module root + the single target tuple M1 builds.
- Real
GoBuild Env - Production
GoBuildEnv: shellsgoand reads the real filesystem.mod_modedefaults to"vendor"— the M1 hermetic contract (vendored tree, no proxy). The one legitimate non-vendor use is a dep-free module (nothing to vendor), which the integration test selects explicitly.
Traits§
- GoBuild
Env - The Environment seam — the ONLY place the encoder touches the world.
Real builds shell
go list+ read files; tests mock both.