selfupdate

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package selfupdate updates the diagrid-dev-dashboard binary in place from GitHub Releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveLatest added in v0.0.6

func ResolveLatest(ctx context.Context, client *http.Client, apiBase, repo string) (string, error)

ResolveLatest queries the GitHub releases API for repo's latest tag_name and returns it normalized (with a leading "v"). The /releases/latest endpoint excludes prereleases by design, so this always resolves to the latest stable release.

Types

type Result

type Result struct {
	From    string
	To      string
	Skipped bool // true when already on the requested/latest version
}

Result describes the outcome of an update.

type Updater

type Updater struct {
	Repo           string
	APIBase        string
	DownloadBase   string
	HTTP           *http.Client
	GOOS           string
	GOARCH         string
	CurrentVersion string
	ExecPath       string
	Out            io.Writer
}

Updater performs an in-place self-update from GitHub Releases. The base URLs, HTTP client, platform, current version, and target path are all injectable so the update flow is fully testable.

func New

func New() (*Updater, error)

New returns an Updater wired to the real GitHub endpoints and the currently running binary.

func (*Updater) Run

func (u *Updater) Run(ctx context.Context, requested string) (Result, error)

Run resolves, downloads, verifies, and installs the requested version (empty means the latest release). It is a no-op when no explicit version is given and the binary is already on the latest version.

Jump to

Keyboard shortcuts

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