selfupdate

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package selfupdate lets the dodo-cli and dodo-tui binaries upgrade themselves in place from the project's GitHub releases: it compares the installed version against the latest release, and when a newer one exists it downloads the matching archive, verifies its checksum, and atomically replaces the running executable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayVersion

func DisplayVersion(v string) string

DisplayVersion returns v, or "dev" when it is empty (an un-injected build).

func Run

func Run(out io.Writer, opts Options) error

Run checks the latest release and, if it is newer than the installed version, downloads the matching archive and replaces the running binary. Progress is written to out. It is a no-op (returning nil) when already current.

Types

type Options

type Options struct {
	CurrentVersion string // installed version, e.g. "v0.2.0" or "dev"
	BinaryName     string // "dodo-cli" or "dodo-tui"
	Repo           string // "owner/name"
	APIBase        string // GitHub API base URL
	HTTPClient     *http.Client
	GOOS           string
	GOARCH         string
	ExePath        string // executable to replace
}

Options configures an upgrade run. Zero-value fields fall back to sensible defaults: the real GitHub API, the running executable, and the host os/arch. The overridable fields exist so tests can point the whole flow at a local server and a temp file.

Jump to

Keyboard shortcuts

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