Documentation
¶
Overview ¶
Package gen checks a Generator's committed outputs for drift and writes fresh ones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply( ctx context.Context, write func(path string, data []byte) error, a types.Artifacts, ) error
Apply writes every artifact through write, in path order.
func NewFromRow ¶ added in v0.0.19
NewFromRow returns the generator row describes. An unknown kind, a run row with no tool runner, a template row with no template or an unknown data provider is CodeInvalidInput naming the row.
Types ¶
type Deps ¶ added in v0.0.19
type Deps struct {
// Tools runs a GenRun row's tool.
Tools interfaces.ToolRunner
// Data are the template data providers, by the name rows use.
Data map[string]DataFunc
}
Deps carries what row generators run with.
type Drift ¶
type Drift struct {
// Diff is a unified diff from the committed outputs to the fresh ones.
Diff string
// Paths are the outputs that differ or are missing, sorted.
Paths []string
// InSync is true when every output matches.
InSync bool
}
Drift is how a generator's committed outputs differ from a fresh render.
func Check ¶
func Check(ctx context.Context, cb interfaces.Codebase, g interfaces.Generator) (Drift, error)
Check renders g over cb and compares each output with the file cb holds; a missing file is drift from nothing.
Click to show internal directories.
Click to hide internal directories.