release

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package release holds what the release commands share: the list of modules this repository publishes, the tag each one is released under, and the check that a module builds against the versions its own go.mod names.

The check is the whole safety argument for a release. A nested module requires the core at a published tag rather than through a replace directive, and go.work overrides that during development, so a green workspace test says nothing about what a downstream go get resolves. Running the same build with the workspace off, against exactly the version in the require line, is what says the published module works.

Index

Constants

This section is empty.

Variables

View Source
var Modules = []Module{
	{Dir: ".", Prefix: "", Major: 0, TracksCore: true, Title: "%s — %s"},
	{Dir: "backend/gg", Prefix: "backend/gg/", Major: 0, TracksCore: true, Title: "backend/gg %s — the raster path at core %s"},
	{Dir: "arrow/v18", Prefix: "arrow/", Major: 18, Title: "arrow/%s — the adapter at core %s"},
	{Dir: "backend/gg/gpu", Prefix: "backend/gg/gpu/", Major: 0, Title: "backend/gg/gpu %s — the tier at core %s"},
	{Dir: "backend/window", Prefix: "backend/window/", Major: 0, TracksCore: true, Title: "backend/window %s — the native path at core %s"},
}

Modules is every module this repository publishes, in dependency order. Tagging no longer has to follow that order — see Check — but reporting still reads better along it.

Functions

func Check

func Check(dir string) error

Check builds, tests and vets a module against the versions its own go.mod names, with the workspace disabled. It never edits manifests or tags.

Green means the module works with the core it requires, which is all a release has to promise: that require is a floor, and minimal version selection raises it for anyone importing both. So a green check licences the tag without the require line naming the version being tagged. Red is the signal — and the only signal — that a require line has to move.

func CheckPushed

func CheckPushed() error

CheckPushed refuses to tag a commit that is not on the upstream branch. Pushing a tag does not push the commit under it, so a tag on a local-only commit publishes a version the proxy cannot fetch — and the proxy caches that failure.

func CheckWorktree

func CheckWorktree() error

CheckWorktree refuses to release from a tree that does not match what is committed. A tag names a commit, so anything only in the working tree is not in the release however green the check was.

func Command

func Command(dir string, args ...string) *exec.Cmd

Command builds a go command for a module directory, under the release environment.

func CreateTag

func CreateTag(name, message string) error

CreateTag writes an annotated tag on HEAD.

func DeleteTag

func DeleteTag(name string) error

DeleteTag removes a local tag, to undo a tagging that could not be finished.

func PushTags

func PushTags(remote string, names []string) error

PushTags pushes tags to a remote in one call, so a release either arrives or does not.

func Tags

func Tags() ([]string, error)

Tags is every tag in the repository.

Types

type Module

type Module struct {
	// Dir is the module directory relative to the repository root, "." for
	// the core.
	Dir string
	// Prefix is what its tags begin with: the directory without the
	// major-version suffix, empty for the core. A module's tag prefix is its
	// subdirectory without that suffix even when the module lives in a
	// major-version subdirectory, which is why arrow/v18 tags as arrow/
	// (ADR 0030).
	Prefix string
	// Major is the major version its tags must carry. A module path without
	// a /vN suffix can only publish v0 or v1, and one with a suffix has to
	// match it.
	Major int
	// TracksCore is set for the modules released in lockstep with the core:
	// the supported raster and native paths, whose own APIs are small enough
	// that a version of their own would say less than the core's does.
	TracksCore bool
	// Title formats the first line of the tag message, taking the module's
	// version and then the core's.
	Title string
}

A Module is one of the modules this repository publishes.

func Find

func Find(dir string) (Module, error)

Find returns the module released from a directory.

func ForTag

func ForTag(tag string) (Module, error)

ForTag returns the module a release tag belongs to. The longest prefix wins, so backend/gg/gpu/v0.3.0 is the GPU tier rather than a strangely named release of the raster backend.

func (Module) CheckVersion

func (m Module) CheckVersion(v Version) error

CheckVersion rejects a version this module cannot publish under. Go resolves a module path without a /vN suffix only at v0 or v1, and a path with one only at that major, so a wrong major here is a tag nothing can require.

func (Module) Latest

func (m Module) Latest(tags []string) (Version, bool)

Latest is the highest version already tagged for a module, and whether there is one. Tags are attributed with ForTag, so the raster backend's history does not pick up the GPU tier's tags.

func (Module) Message

func (m Module) Message(v, core Version, summary string) string

Message is the annotated tag message, given the core's version.

func (Module) Tag

func (m Module) Tag(v Version) string

Tag is the release tag for a version of this module.

type Version

type Version struct{ Major, Minor, Patch int }

A Version is a release version. Release tags carry no prerelease or build metadata: a version that is not ready to be required by name is not ready to be tagged.

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion reads a vMAJOR.MINOR.PATCH version.

func (Version) Less

func (v Version) Less(w Version) bool

Less orders two versions.

func (Version) NextPatch

func (v Version) NextPatch() Version

NextPatch is the version a module gets when a release does not change its own API — the default for the modules that do not track the core.

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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