updatecheck

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package updatecheck queries GitHub for the latest bones release tag and emits a one-line stderr notice when the running binary is behind. Best-effort and rate-limited (once per 24h cached on disk). Called from cmd/bones/main.go at process start.

Design notes:

  • The notice is printed synchronously from the on-disk cache. The network refresh runs asynchronously and may not finish before a short-lived CLI process exits — that's OK; the next long- enough invocation picks up the new latest.
  • "dev" builds (no version embedded) skip the check entirely so local hacking never triggers a network call.
  • Suppressed by env var BONES_UPDATE_CHECK=0.
  • All errors are silent: an update check that fails must never interfere with the verb the user actually ran.

Index

Constants

This section is empty.

Variables

View Source
var CacheTTL = 24 * time.Hour

CacheTTL is the minimum interval between network refreshes. Exported for tests; production callers leave it at 24h.

View Source
var FetchTimeout = 3 * time.Second

FetchTimeout caps how long the async refresh waits for GitHub.

View Source
var LatestReleaseURL = "https://api.github.com/repos/danmestas/bones/releases/latest"

LatestReleaseURL is the GitHub API endpoint queried for the latest release tag. Exported so tests can override it without monkey-patching.

View Source
var UpgradeHint = "brew upgrade danmestas/tap/bones"

UpgradeHint is the user-facing instruction appended to every notice. One-line so the notice fits on a single stderr row.

Functions

func Check

func Check(currentVersion string)

Check is the public entry point. Reads the cache, prints a notice to stderr if the running binary is behind, and spawns an async refresh when the cache is stale. Never blocks the caller for the network round-trip.

func Newer

func Newer(latest, current string) bool

Newer reports whether latest is a strictly newer semver than current. Both inputs may carry a leading "v"; non-numeric suffixes (pre-releases) cause Newer to return false to avoid spurious notices.

Types

This section is empty.

Jump to

Keyboard shortcuts

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