releasedigest

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package releasedigest is the release digest: per release, its tag, the tag it was cut from, and each changelog line as `abcd launch ship` composed it, with the records the line cites and their impact (spc-2610170635097509).

The digest travels inside the binary. `launch ship` appends the release it cuts to the file a repository declares under `release.digest`, and abcd's own declaration is this package's digest.json, which go:embed carries into the binary built from the release's tag. So a binary holds every release up to and including its own, and says what changed in an update without reading the repository it runs in or the network. The `.abcd/` namespace never reaches a released binary, which is why the file lives here.

The embedded file is read as strictly as any other embedded default: one JSON document, no unknown field, no repeated key, nothing after it, capped in size, every version exactly a release tag, and every line sanitised again on read.

Index

Constants

View Source
const (
	// MaxBytes caps the document, for the reader here and for the cut's read
	// of the file it appends to. The seed is a few hundred KiB and a release
	// adds tens; the cap leaves years of headroom and bounds a file that has
	// grown wrong.
	MaxBytes = 8 << 20
)
View Source
const SchemaVersion = 1

SchemaVersion is the digest document's schema version. A document from a newer schema is refused, never half-read.

Variables

View Source
var ErrNotReleaseTag = errors.New("not a release tag of the form vMAJOR.MINOR.PATCH")

ErrNotReleaseTag is Range's refusal of a version that is not exactly a release tag; a dev build takes no part.

Functions

func Append

func Append(existing []byte, rel Release) ([]byte, error)

Append adds rel as the newest release of the digest existing holds (empty for a digest not yet written) and returns the whole new document. The release must validate and be newer than every release already there; a digest that does not parse is refused rather than rebuilt.

Types

type Digest

type Digest struct {
	Releases []Release
	// contains filtered or unexported fields
}

Digest is the whole document, releases newest first.

func Parse

func Parse(data []byte) (*Digest, error)

Parse reads a digest document strictly and validates every release.

func (*Digest) Range

func (d *Digest) Range(from, to string) (Summary, error)

Range returns the releases after from up to and including to, walking the chain of base tags down from to. A release the chain reaches that the digest does not carry stops the walk and is named in the gap, with where its notes are published, and the summary is partial. from "" means the running release alone; a from at or above to is an empty range. Either version must be exactly a release tag.

type Entry

type Entry struct {
	Line    string   `json:"line"`
	Records []Record `json:"records"`
}

Entry is one changelog line, stored once with every record it cites. Line is the line's wording without the citation suffix the cut appends.

func (Entry) NeedsAction

func (e Entry) NeedsAction() bool

NeedsAction reports whether the entry asks the person to act: any record it cites is breaking (the changelog states a break as an Added line, so the impact, not the section, is the signal).

type Gap

type Gap struct {
	After       string `json:"after,omitempty"`
	Through     string `json:"through"`
	NotesURL    string `json:"notes_url"`
	ReleasesURL string `json:"releases_url"`
}

Gap names what a range cannot describe: the release Through, and any release after After below it, which the chain cannot list. NotesURL is where Through's release notes are published, ReleasesURL where every release's are. Nothing in a gap is guessed.

type Impact

type Impact string

Impact is a cited record's declared impact. Only the three that earn a changelog line appear: an internal record is never cited.

const (
	ImpactAdditive Impact = "additive"
	ImpactBreaking Impact = "breaking"
	ImpactFix      Impact = "fix"
)

type Record

type Record struct {
	ID     string `json:"id"`
	Impact Impact `json:"impact"`
}

Record is one record a line cites, with its declared impact.

type Release

type Release struct {
	Tag     string  `json:"tag"`
	BaseTag string  `json:"base_tag"`
	Entries []Entry `json:"entries"`
}

Release is one cut release: its tag, the tag it was cut from ("" for the first release a repository cut), and its lines in the CHANGELOG's order.

func (Release) NeedsAction

func (r Release) NeedsAction() int

NeedsAction counts the release's entries that need the person to act.

type Summary

type Summary struct {
	From     string    `json:"from,omitempty"`
	To       string    `json:"to"`
	Releases []Release `json:"releases"`
	Gap      *Gap      `json:"gap,omitempty"`
	Partial  bool      `json:"partial"`
}

Summary is a range of releases: those the digest describes, newest first with each release's entries needing action first, and the gap, if any. Partial is true exactly when there is a gap.

func Range

func Range(from, to string) (Summary, error)

Range is the embedded digest's Range.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL