upgrade

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package upgrade implements self-updating from GitHub releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetName

func AssetName(tag string) string

AssetName returns the release archive name for this platform.

func AssetURL

func AssetURL(tag, name string) string

AssetURL returns the download URL for a named asset of a release.

func CurrentExecutable

func CurrentExecutable() (string, error)

CurrentExecutable resolves the real path of the running binary.

func Download

func Download(ctx context.Context, url string) (string, error)

Download fetches url into a temp file and returns its path.

func ExtractBinary

func ExtractBinary(archivePath string) (string, error)

ExtractBinary pulls the chunder executable out of the release archive into a temp file and returns its path.

func IsHomebrew

func IsHomebrew(exe string) bool

IsHomebrew reports whether the binary lives in a Homebrew cellar, where brew should manage upgrades instead of us.

func LatestTag

func LatestTag(ctx context.Context) (string, error)

LatestTag resolves the newest release tag by following GitHub's releases/latest redirect. Unlike the REST API, this is not rate-limited, so it works from shared IPs without a token.

func Replace

func Replace(exe, newBin string) error

Replace atomically swaps the executable at exe with the file at newBin. The temp copy must land on the same filesystem for rename to be atomic, so it is staged next to the target first.

func Verify

func Verify(ctx context.Context, archivePath, assetName, checksumsURL string) error

Verify checks the archive against the release's checksums.txt.

Types

This section is empty.

Jump to

Keyboard shortcuts

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