Documentation
¶
Overview ¶
Package drift compares two scans and their maps: which facts and which conclusions were added, removed or changed. Facts are compared by kind and key, so a moved line is never drift; map items by their identity (a party by id, a link by service and recipe, a finding by rule and subject, so a new detail is a change).
Index ¶
Constants ¶
const SchemaID = "cernly.drift/v1"
SchemaID is the id every drift document is written with.
const SectionTransitive = "dependency_transitive"
SectionTransitive groups transitive dependencies apart from the direct ones.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
Change string `json:"change"` // added, removed, changed
Section string `json:"section"` // fact kind, or map section (parties, links, stacks, ...)
Key string `json:"key"`
Before json.RawMessage `json:"before,omitempty"`
After json.RawMessage `json:"after,omitempty"`
}
type Drift ¶
type Drift struct {
Schema string `json:"schema"`
Repo string `json:"repo"`
From Ref `json:"from"`
To Ref `json:"to"`
Facts []Change `json:"facts"`
Map []Change `json:"map"`
}
type DriftGroup ¶
type DriftGroup struct {
Section string `json:"section"`
Label string `json:"label"`
One string `json:"one"` // the label for a count of one ("1 data store")
Added int `json:"added"`
Removed int `json:"removed"`
Changed int `json:"changed"`
Examples []string `json:"examples"`
}
DriftGroup is one kind of fact in a drift, counted, with a few examples.
func Groups ¶
func Groups(d *Drift) []DriftGroup
Groups counts a drift's fact changes per kind, in a fixed order, with up to four examples each.
func MapGroups ¶
func MapGroups(d *Drift) []DriftGroup
MapGroups does the same for the map's changes, per map section.