Documentation
¶
Overview ¶
Package updatecheck notifies users about newer eng releases without a manual `eng version` check, npm-style: a short stderr notice after the command runs.
It is designed to never slow down or break a command invocation:
- The notice is served from a local cache file under the OS cache dir, so the common path performs one small file read and no network I/O.
- Refreshing the cache happens in a fire-and-forget goroutine with a short timeout; failures are swallowed silently.
- The check is skipped for dev builds, when ENG_NO_UPDATE_CHECK is set, for the `version` command itself (it does its own check), and in tests (via ui.DisableProgress, mirroring runlog).
Index ¶
Constants ¶
const ( // CheckInterval is how often the cached latest-release tag is refreshed. CheckInterval = 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func CacheFile ¶
CacheFile returns the cache path, creating the parent dir when possible. ENG_UPDATE_CHECK_FILE overrides the default (OS cache dir), keeping tests hermetic.
func NotifyIfAvailable ¶
func NotifyIfAvailable(cmdName string)
NotifyIfAvailable prints a short npm-style update notice to stderr when the cached latest tag is newer than the running version. It performs no network I/O. Pass the invoked (sub)command name so self-checking and machine-consumed commands stay quiet.
func RefreshAsync ¶
func RefreshAsync()
RefreshAsync refreshes the cached latest-release tag in the background when the cache is missing or older than CheckInterval. It returns immediately and never reports errors; the next invocation serves the refreshed value.
func ShouldSkip ¶
ShouldSkip reports whether the notice/refresh should be skipped for the invoked command name (e.g. "version", "completion", "__complete").
Types ¶
This section is empty.