Documentation
¶
Overview ¶
Package config loads vp.yaml and resolves affected components.
Index ¶
Constants ¶
const ( ConsumedDelete = "delete" ConsumedArchive = "archive" )
Allowed values for plans.consumed.
const ( FormatJSON = "json" FormatYAML = "yaml" FormatTOML = "toml" FormatText = "text" )
Allowed values for components[*].version.format.
const Filename = "vp.yaml"
Filename is the canonical name of the vp config file.
Variables ¶
var ErrNotFound = errors.New("vp.yaml not found")
ErrNotFound is returned by FindUpwards (and Load) when no vp.yaml exists in startDir or any of its ancestors.
Functions ¶
func FindUpwards ¶
FindUpwards searches startDir and its ancestors for a vp.yaml file, returning the absolute path to the first match. ErrNotFound is returned if no ancestor contains one.
Types ¶
type Component ¶
type Component struct {
Paths []string `yaml:"paths"`
Version VersionTarget `yaml:"version"`
Tag string `yaml:"tag"`
}
Component is one independently-versioned unit declared in vp.yaml.
type Config ¶
type Config struct {
Plans PlansConfig `yaml:"plans"`
Components map[string]Component `yaml:"components"`
// Dir is the directory that contained the loaded vp.yaml.
Dir string `yaml:"-"`
}
Config is a parsed vp.yaml. After Load, all path-shaped fields (Plans.Dir, Plans.ArchiveDir, Components[*].Version.File) are absolute paths rooted at Dir. Components[*].Paths are kept as relative globs — they are matched against repo-relative file paths by future Affected logic.
func Load ¶
Load finds vp.yaml by searching upward from startDir, parses it, validates required fields, and resolves all relative paths against the directory that contained the file.
func (*Config) Affected ¶
Affected returns the sorted set of component names whose path globs match at least one entry in changedPaths. Paths under cfg.Plans.Dir and the vp.yaml file itself are ignored — planning churn never triggers a coverage check.
changedPaths must be relative to cfg.Dir (the directory containing vp.yaml).
type PlansConfig ¶
type PlansConfig struct {
Dir string `yaml:"dir"`
Consumed string `yaml:"consumed"`
ArchiveDir string `yaml:"archive_dir"`
}
PlansConfig configures the plans directory and how plans are consumed.
type VersionTarget ¶
type VersionTarget struct {
File string `yaml:"file"`
Format string `yaml:"format"`
Path string `yaml:"path"`
}
VersionTarget points at the file owning a component's canonical version.