Documentation
¶
Index ¶
- Variables
- func CheckVersion(ctx context.Context, stderrLogger *zerolog.Logger)
- func DetectLatest(ctx context.Context, prerelease bool) (string, error)
- func DownloadAndApply(ctx context.Context, tag, exePath string) error
- func IsDevBuild() bool
- func IsNewer(candidate, current string) bool
- func IsPrerelease() bool
Constants ¶
This section is empty.
Variables ¶
var ( AppVersion = devBuild // In release builds this will be overwritten via ldflags GitCommit = "unknown-commit" // -"- )
Functions ¶
func DetectLatest ¶
DetectLatest returns the latest available version. When prerelease is true it returns the latest dev/prerelease version (from the Atom feed); otherwise it returns the latest GA release (from the /releases/latest redirect). Neither path touches the throttled api.github.com endpoint.
func DownloadAndApply ¶
DownloadAndApply downloads the release archive for the given version from the GitHub CDN (not the throttled api.github.com), extracts the 'metaplay' binary, and atomically replaces the executable at exePath.
It reuses go-selfupdate's standalone helpers for the archive handling and the safe, cross-platform binary swap, so we don't have to reimplement either.
The archive is tens of MB, so this deliberately does NOT impose a hard timeout (a slow connection should not fail a legitimate update). Cancellation is governed by ctx, so the caller can bound or interrupt it (e.g. Ctrl+C via the command context).
func IsDevBuild ¶
func IsDevBuild() bool
func IsNewer ¶
IsNewer reports whether candidate is a strictly newer version than current. Both are plain version strings (no leading 'v'). On parse failure it returns false, so a malformed version is never treated as an available update.
func IsPrerelease ¶
func IsPrerelease() bool
IsPrerelease returns true if the current version is a prerelease build (e.g. "0.1.3-dev.5"), but not a local development build ("dev").
Types ¶
This section is empty.