selfupdate

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package selfupdate lets the scout binary upgrade itself from GitHub Releases: it finds the latest published version, and replaces the running executable with the matching release asset for this OS/arch. It is used by `scout update` and by the throttled auto-update check on startup.

Index

Constants

View Source
const Repo = "MUKE-coder/scout"

Repo is the GitHub repository releases are published to.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, rel Release) error

Apply downloads the release asset and replaces the running executable with the scout binary inside it. It is safe while running: on Windows the current executable is renamed aside first (a running .exe cannot be overwritten, but it can be moved), then the new binary takes its place.

func AssetName

func AssetName() string

AssetName is the GoReleaser asset file name for this OS/arch.

func Newer

func Newer(current, released string) bool

Newer reports whether released (e.g. "v0.4.16" or "0.4.16") is a higher semantic version than current. A dev/unparseable current is never "older" of its own accord — callers guard dev builds separately — but Newer returns false when either side cannot be parsed, so a bad read never triggers an update.

Types

type Release

type Release struct {
	Tag   string
	URL   string // browser_download_url of the asset for this OS/arch
	Asset string // asset file name
}

Release is the subset of the GitHub release API we read.

func Latest

func Latest(ctx context.Context) (Release, error)

Latest returns the latest published release and the download URL of its asset for the current OS/arch.

Jump to

Keyboard shortcuts

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