Documentation
¶
Overview ¶
Package diff compares two compiled specs and lists what changed in meaning (§11.5). It reads only compiled specs; finding the earlier one in git is the project package's job.
Index ¶
Constants ¶
const FormatVersion = "0.1"
FormatVersion is the version of the JSON report (S17.1, S17.13).
Variables ¶
var Kinds = []Kind{Added, Removed, Dropped, Downgraded, Accepted, Reworded, Weakened, Strengthened, Reversed}
Kinds lists every kind in the order of the diff table.
Functions ¶
func Line ¶
Line is a rule as the report shows it: its ID, its sentence as written with spaces normalised, and its tags.
func WriteMarkdown ¶
WriteMarkdown writes the report as the "What this changes" section of a proposal: a heading for each kind with changes, in the order of the diff table, and under it each rule with where it is, its line before and after, and the other kinds it is listed under.
Types ¶
type ByKind ¶
type ByKind struct {
Added []Entry `json:"added"`
Removed []Entry `json:"removed"`
Dropped []Entry `json:"dropped"`
Downgraded []Entry `json:"downgraded"`
Accepted []Entry `json:"accepted"`
Reworded []Entry `json:"reworded"`
Weakened []Entry `json:"weakened"`
Strengthened []Entry `json:"strengthened"`
Reversed []Entry `json:"reversed"`
}
ByKind holds the entries of each kind, in the order of the diff table.
type Change ¶
Change is one rule that changed, with every kind it is listed under (S16.1). Before is nil for an added rule and After for a removed one.
func Compare ¶
Compare lists the rules that changed in meaning between two specs, in the order of their files and lines.
Rules with IDs are matched by ID (S16.2). Rules without are matched by their text with spaces normalised (S16.3), so any change of words to a rule without an ID, a change of spelling included, shows as removed and added.
type Entry ¶
type Entry struct {
ID *string `json:"id"`
File string `json:"file"`
Lines spec.Lines `json:"lines"`
Before *string `json:"before"`
After *string `json:"after"`
}
Entry is one change under one kind in the JSON report. File and Lines say where the rule is now, or where it was for a removed rule. Before and After are the rule's line as Line writes it, or null.