Documentation ¶
Overview ¶
Package changes contains tools for working with change logs written in a particular format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractSection ¶
ExtractSection will return a reader that will output the bullets that are written below the changelog heading for the given version. The first argument is the file name of the changelog to open and the second line is a semver string to search for. Returns an error if there is a problem reading the file or if the version heading is not found.
Types ¶
type CheckMode ¶
type CheckMode int
CheckMode identifies the kind of linting to perform on a changelog.
const ( // CheckStandard merely checks that the syntax of the changelog file appears // to be sane. CheckStandard CheckMode = 0 + iota // CheckPreRelease checks the syntax and then checks that the first section // is a WIP section. CheckPreRelease // CheckRelease checks the syntax and then checks that the first section is // not a WIP section. CheckRelease )
type Error ¶
type Error struct {
Failures
}
Error is an error made up of Failures and is returned by the Linter.Check method when one or more problems are detected in the changelog.
type Linter ¶
type Linter struct {
// contains filtered or unexported fields
}
Linter is the object with methods for performing changelog linting. The expected format for changelogs being linted by this method looks like this:
WIP TBD * This is a change line for the work in progress. * This is a long line that will end up wrapped in the file because it is long and long lines are tedious if you have to scroll horizontally. v1.0 2023-03-04 * This is the change for the latest release.
A changelog is made up of one or more sections. Each section starts with a heading of the form "<vstring> <date>" with exactly two spaces between the vstring and date. The first section may be "WIP TBD". (During a pre-release check, the first section must be a WIP section and during a release check, the first section must not be a WIP section.) This heading must be followed by a blank line. Then there are one or more bullet lines, each of which must start with " * " at the very start of the line. A bullet line may be continued on one or more following lines by ensuring that at least 3 spaces start each of those lines. Finally, prior to starting a new section head there must be another blank. Other than that, anything goes.