Documentation
¶
Overview ¶
Package update checks GitHub for newer clawker releases and caches results.
Foundation-tier package: stdlib + net/http + yaml.v3, no internal imports. The caller passes the current version string (no dependency on internal/build).
Designed for background use — the caller launches CheckForUpdate in a goroutine with a cancellable context. Context cancellation cleanly aborts the HTTP request when the CLI command finishes before the check completes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldCheckForUpdate ¶
ShouldCheckForUpdate returns false if update checks should be suppressed. Suppression conditions:
- CLAWKER_NO_UPDATE_NOTIFIER env var is set (non-empty)
- CI env var is set (non-empty) — standard CI detection
- currentVersion is "DEV" — development build
- stateFilePath is non-empty and cache is fresh (checked < 24h ago)
Types ¶
type CheckResult ¶
CheckResult is returned when a newer version is available.
func CheckForUpdate ¶
func CheckForUpdate(ctx context.Context, stateFilePath, currentVersion, repo string) (*CheckResult, error)
CheckForUpdate checks the GitHub API for a newer release of the given repo. Returns (nil, nil) if the current version is latest or checks are suppressed. Returns (nil, error) on API/network failures. Returns (*CheckResult, nil) when a newer version is available.
The context controls the HTTP request lifetime — cancel it to abort cleanly. repo should be "owner/name", e.g. "schmitthub/clawker".