selfupdate

package
v0.56.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package selfupdate replaces the running fullsend CLI binary with a release from GitHub Releases. It installs a release only when the Sigstore signature on its checksums.txt verifies for that tag and the archive matches its recorded SHA256.

Index

Constants

This section is empty.

Variables

View Source
var ErrDevBuild = errors.New("this fullsend binary is a development build; self-update only replaces release binaries")

ErrDevBuild is returned when the running binary is not a release build, so there is no release version to compare against.

Functions

This section is empty.

Types

type Options

type Options struct {
	// CurrentVersion is the version of the running binary.
	CurrentVersion string
	// TargetVersion is the release to install, such as "v0.53.0". Empty
	// means the latest release. An explicit version may be older than the
	// current one, which allows rolling back.
	TargetVersion string
	// DryRun reports what would change without installing anything. With
	// TargetVersion set, it checks that the release has a build for this
	// platform.
	DryRun bool
}

Options configures a Run.

type Result

type Result struct {
	Status Status
	// From and To are release tags, for example "v0.52.0".
	From, To string
	// Path is the resolved path of the binary.
	Path string
}

Result describes the outcome of a Run.

type Status

type Status int

Status says what Run did.

const (
	// StatusUpToDate means the binary already runs the target release.
	StatusUpToDate Status = iota
	// StatusAhead means the binary is newer than the latest release (for
	// example a release candidate) and no version was requested.
	StatusAhead
	// StatusWouldUpdate means a dry run found an update to install.
	StatusWouldUpdate
	// StatusUpdated means the binary was replaced.
	StatusUpdated
)

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater replaces the running binary. Build one with New; the function fields are test seams for this package.

func New

func New() *Updater

New returns an Updater for the current platform that talks to GitHub Releases and the Sigstore public-good instance.

func (*Updater) Run

func (u *Updater) Run(ctx context.Context, opts Options) (Result, error)

Run updates the running binary according to opts. Once ctx is cancelled, the binary is not replaced.

Jump to

Keyboard shortcuts

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