update

package
v0.1.30 Latest Latest
Warning

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

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

Documentation

Overview

Package update checks GitHub for a newer WhatTheDock release and, when asked, downloads and installs it in place of the currently running binary. It mirrors two things that already exist elsewhere in this repo rather than inventing new conventions: the release asset naming (cmd/release's releaseBinaryName) and the download flow (scripts/install.sh) — both are whatthedock-<version>-<os>-<arch> fetched from a GitHub release's assets.

Index

Constants

View Source
const Repo = "allisonhere/whatthedock"

Repo is the GitHub "owner/name" WhatTheDock releases are published under.

Variables

This section is empty.

Functions

func AssetName

func AssetName(version string) string

AssetName is the release asset filename for version on the current platform — must match cmd/release's releaseBinaryName exactly, since that's what actually names the uploaded asset.

func DownloadURL

func DownloadURL(repo, version string) string

DownloadURL is the GitHub release asset URL for version.

func IsNewer

func IsNewer(current, latest string) bool

IsNewer reports whether latest is a strictly newer vMAJOR.MINOR.PATCH version than current. Either string failing to parse in that shape (notably "dev", the ldflags default for a non-release build) always reports false — there's no sane "current" to compare against, so it's treated as never eligible for an update prompt rather than guessed at.

func LatestRelease

func LatestRelease(ctx context.Context, repo string) (string, error)

LatestRelease fetches repo's latest published release tag (e.g. "v0.1.4") from the GitHub API.

func ReplaceRunningExecutable

func ReplaceRunningExecutable(ctx context.Context, repo, version string) (string, error)

ReplaceRunningExecutable downloads version's release asset for repo, verifies it against the matching detached signature (see verify.go) before touching anything, and only then atomically replaces the currently running binary with it. It returns the executable's path so the caller can re-exec into it — this package never does that itself, since replacing a running process image is a main-package/process- lifecycle concern, not something a library package should reach for.

func SignatureAssetName added in v0.1.12

func SignatureAssetName(version string) string

SignatureAssetName is the detached-signature asset filename cmd/release publishes alongside AssetName's binary — see verify.go.

func SignatureDownloadURL added in v0.1.12

func SignatureDownloadURL(repo, version string) string

SignatureDownloadURL is the GitHub release asset URL for version's detached signature.

func SigningKeyMatches added in v0.1.27

func SigningKeyMatches(privKeyHex string) (bool, error)

SigningKeyMatches reports whether privKeyHex (the hex ed25519 private key cmd/release signs with) corresponds to the public key this package bakes in. The release tool calls it as a preflight so a drifted or rotated key is caught before a build+sign, instead of producing a binary every installed app would reject. A malformed key is an error, not merely false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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