Documentation
¶
Index ¶
- func CachePath(homeDir string) string
- func CompareVersions(current, latest string) bool
- func FetchLatestVersion(ctx context.Context, client *http.Client) (string, error)
- func IsCacheFresh(entry *CacheEntry, now time.Time) bool
- func WriteCache(homeDir string, entry *CacheEntry) error
- type CacheEntry
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶
CompareVersions returns true if latest is newer than current. Both should be semver-like strings (with or without 'v' prefix).
func FetchLatestVersion ¶
FetchLatestVersion fetches the latest release tag from GitHub. Uses the provided HTTP client (allows injection for testing).
func IsCacheFresh ¶
func IsCacheFresh(entry *CacheEntry, now time.Time) bool
IsCacheFresh returns true if the cache entry is less than cacheTTL old.
func WriteCache ¶
func WriteCache(homeDir string, entry *CacheEntry) error
WriteCache writes the update check result to the cache file. Silently returns nil on error (cache is best-effort).
Types ¶
type CacheEntry ¶
CacheEntry represents the cached update check state.
func ParseCache ¶
func ParseCache(content string) *CacheEntry
ParseCache parses cache file contents into a CacheEntry. Returns nil if the content is malformed.
func ReadCache ¶
func ReadCache(homeDir string) *CacheEntry
ReadCache reads the cached update check result. Returns nil if the cache doesn't exist or is malformed.
type Result ¶
Result holds the outcome of an update check.