Documentation
¶
Overview ¶
Package update implements background version checking and self-updating for the dispatch CLI. Versions are fetched from GitHub Releases and verified via SHA-256 checksums before replacing the running binary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetName ¶
AssetName returns the expected release archive filename for the current platform and architecture.
func CompareVersions ¶
CompareVersions compares two semantic version strings (e.g. "1.2.3"). Returns -1 if a < b, 0 if a == b, 1 if a > b. A leading "v" prefix is stripped. Non-numeric parts are treated as 0.
func ParseChecksum ¶
ParseChecksum extracts the SHA-256 hash for a specific file from a checksums.txt file in "hash filename\n" format.
func RunUpdate ¶
RunUpdate downloads and installs the latest version of dispatch. It prints progress to stderr and returns an error on failure.
func SHA256File ¶
SHA256File computes the SHA-256 hash of a file and returns it as a lowercase hex string.
Types ¶
type UpdateInfo ¶
UpdateInfo describes an available update.
func CheckForUpdate ¶
func CheckForUpdate(currentVersion string) *UpdateInfo
CheckForUpdate checks whether a newer version of dispatch is available on GitHub. It returns nil if the current version is up to date, is a dev build, or any error occurs. This function is safe to call from a goroutine — it never panics and silently returns nil on all errors.