Documentation
¶
Overview ¶
Package gen orchestrates generation: it drives parsing, naming, lowering, and emission for every package matched by the CLI's patterns.
Index ¶
Constants ¶
const LawsTestSuffix = "_gp_laws_test.go"
LawsTestSuffix names generated law-test files.
Variables ¶
This section is empty.
Functions ¶
func ExpandPatterns ¶ added in v0.144.0
ExpandPatterns resolves go-style package patterns to directories under root; the goml front end shares the go tool's matching convention.
func GenSiblings ¶
GenSiblings computes the derivable-enum name set for one package.
func RenderEnumGen ¶
RenderEnumGen renders Gen<Enum> and its depth helper. qual prefixes constructor and type references when the generator is emitted outside the enum's package ("" for same-package). ok is false when the enum cannot derive a generator (generic, indexed, or uninhabited at any depth).
Types ¶
type Options ¶
type Options struct {
Dir string // working directory; resolved against pattern paths
Patterns []string // go-style package patterns; default ["./..."]
Check bool // verify only: report stale outputs, write nothing
Stage bool // after writing, git-add changed/deleted outputs
BuildTags []string // target-specific tags used by go/packages validation
// Overlay substitutes in-memory contents for on-disk .gp files
// (absolute path → bytes) — the LSP's unsaved buffers.
Overlay map[string][]byte
// DryRun computes diagnostics and outputs without writing anything
// (and without staging or orphan deletion).
DryRun bool
}
Options configures a generation run.
type Result ¶
type Result struct {
Written []string // files written (or deleted orphans, in write mode)
Stale []string // check mode: outputs missing or out of date
Orphans []string // generated files whose .gp source is gone
Outputs map[string][]byte // DryRun: would-be generated content
Diags []diag.Diagnostic
}
Result reports what a run did (paths relative to Options.Dir when under it).