Documentation
¶
Overview ¶
Package source verifies and persists bounded edits to captured Go properties. It is development tooling: producers are trusted programs, not sandboxed input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
// contains filtered or unexported fields
}
Change retains the verified candidate and its input revisions privately.
func Prepare ¶
func Prepare(ctx context.Context, producer GoProducer, target Target, proposal export.PropsProposal) (*Change, error)
Prepare runs the actual producer, its existing proposal operation and a fresh build with the candidate Go overlay. All three must agree on the full export. Only existing keyed string literals can change; no source files are written. Temporary overlays and module copies are removed before returning.
func (*Change) Apply ¶
Apply rechecks the producer's build inputs and replaces exactly one source file using a same-directory atomic rename. Unix advisory locking serializes cooperating writers; other platforms refuse. An unrelated editor can still race the last check and rename, so this is not filesystem compare-and-swap. File mode is preserved; ownership, ACLs and extended attributes are not copied.
type GoProducer ¶
GoProducer selects a caller-owned main package in Dir, its module root. Package is . or a relative ./path. Args select the full source composition. The producer must emit one DesignExport JSON object, and accept the same Args followed by --proposal with PropsProposal JSON on stdin. Builds disable cgo, workspaces and GOFLAGS; custom build configurations are not supported yet. Constructors must be deterministic and free of external side effects.
type Review ¶
type Review struct {
File string `json:"file"`
BeforeSHA256 string `json:"beforeSHA256"`
AfterSHA256 string `json:"afterSHA256"`
BaseSHA256 string `json:"baseSHA256"`
ResultSHA256 string `json:"resultSHA256"`
Source string `json:"source"`
}
Review is detached evidence, not authority to apply arbitrary source bytes.