extensionrepo

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package extensionrepo runs repository tasks through the extension's export program. It owns checks, contract lookup, updates, staged install, and uninstall, as Extension repository in contract.md defines. Its test wrapper prints notices after Go's package results, as Test kit defines.

Index

Constants

View Source
const ScenarioEnv = "NCLY_TEST_SCENARIO"

ScenarioEnv names the scenario that a run of go test runs alone, for just scenario and for the repeat of signoff. When -run is ScenarioRun of that name, the test kit skips its coverage checks, which need every scenario.

Variables

This section is empty.

Functions

func Install

func Install(e extension.Extension, executable, dir string) error

Install stages executable and the embedded sidecars of e, then publishes the executable last. The kit uses it with its built executable and a scratch extensions folder.

func Main

func Main(e extension.Extension)

Main runs a repository task, then exits. The export subcommand writes embedded sidecars for the staged build.

func Notice

func Notice(message string) error

Notice records a test notice for Test to print after the packages finish. Outside the owned run of Test, it writes to stdout, which go test can hide for passing packages.

func ScenarioRun added in v0.25.0

func ScenarioRun(name string) string

ScenarioRun is the -run pattern of go test that selects only the scenario testdata/script/<name>.txtar.

func Test

func Test(args []string) int

Test runs go test without its result cache, then prints notices to stderr outside Go's output filter. It accepts go test arguments, defaults to ./..., and preserves the test exit code.

func Uninstall

func Uninstall(e extension.Extension, dir string) ([]string, error)

Uninstall removes e from dir, with the executable first. It returns the paths removed, in order, and accepts an absent install.

Types

type OwnedRun added in v0.26.0

type OwnedRun struct {
	// Dir is the folder of the run. A scratch run holds HOME, TMPDIR, and
	// the XDG folders there. A host run keeps its notices there.
	Dir string
	// Env is the whole environment of each program that the run starts.
	Env []string
}

OwnedRun is the environment and the scratch folder of one verification run, as Owned runs in the contract defines. The test kit, signoff, release, and acceptance each build theirs with NewOwnedRun. The analyzer callerenv refuses os.Environ elsewhere in this package and the kit.

func NewOwnedRun added in v0.26.0

func NewOwnedRun(dir string, p Profile) (OwnedRun, error)

NewOwnedRun builds the environment of a run in dir, which must be an absolute path, or empty for a host run without notices. It is the one function of the kit and the repository gates that reads the environment of the caller as a whole.

Each run masks GOFLAGS with a blank value, which also masks one that go env -w keeps, and sets GOWORK=off, unless Keep names them. A host run with a folder records the notices of its programs in that folder.

func (OwnedRun) Notices added in v0.26.0

func (r OwnedRun) Notices() ([]byte, error)

Notices returns the notices that the programs of a host run recorded.

type Profile added in v0.26.0

type Profile struct {
	// Scratch gives the run its own HOME, TMPDIR, and XDG folders in Dir,
	// and no D-Bus session. It keeps no other variable of the caller.
	// Without Scratch, the run keeps the tools and accounts of the caller,
	// and drops the caller state of dropped.
	Scratch bool
	// Path holds the folders that go first in PATH, before those of the
	// caller that hold no ncly-* file. Only a scratch run reads it.
	Path []string
	// Keep names the variables of the caller that the run keeps anyway,
	// such as GIT_CONFIG_GLOBAL.
	Keep []string
	// Set gives variables their values in the run, after all others.
	Set map[string]string
}

Profile says what an owned run keeps of its caller.

type SpecKind added in v0.25.0

type SpecKind int

SpecKind says what a line of spec.md is.

const (
	SpecText SpecKind = iota
	SpecBlank
	SpecSeparator
	SpecHeading
	SpecLabel
	SpecHeader
	SpecRow
	SpecBullet
)

The kinds of a line of spec.md. SpecText is prose.

type SpecLine added in v0.25.0

type SpecLine struct {
	Part   string
	Number int
	Kind   SpecKind
	// Cells holds the cells of a header or a row, without spaces around them.
	Cells []string
	// ID holds the spec ID that starts a row or a bullet, or "".
	ID string
	// Rest holds the text after the bold label of a SpecLabel.
	Rest string
}

A SpecLine is one line of spec.md, read as "Spec IDs" in the contract says. A part starts at a heading, or at a line that starts with a bold label, such as **Failures.**, and ends at the next one. The test kit reads the parts Failures and Acceptance, and finish reads Open lines and Limits.

func SpecLines added in v0.25.0

func SpecLines(spec string) []SpecLine

SpecLines reads each line of a spec.md. A row starts with its ID as its first cell. A bullet starts with its ID and a colon, such as - `duration`: the duration. So a bullet that only starts with code holds no ID. The header row of a table is the row above its separator.

Directories

Path Synopsis
cmd
extensionrepo command
Command extensionrepo runs repository tasks through the shared SDK, including from a downloaded Nicely module.
Command extensionrepo runs repository tasks through the shared SDK, including from a downloaded Nicely module.
Command test runs Go tests and prints their collected notices after the package results.
Command test runs Go tests and prints their collected notices after the package results.

Jump to

Keyboard shortcuts

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