Documentation
¶
Overview ¶
Package version provides non-blocking version checking against GitHub releases.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintNotice ¶
func PrintNotice(result *CheckResult, installCmd string) bool
PrintNotice prints an upgrade notice to stderr if a newer version is available. Returns true if a notice was printed.
Types ¶
type CheckResult ¶
CheckResult holds the outcome of a version comparison.
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker performs async version checks against GitHub releases.
func NewChecker ¶
NewChecker creates a version checker for the given current version.
func (*Checker) Result ¶
func (c *Checker) Result() *CheckResult
Result returns the check result. It blocks briefly (up to 100ms) for the background check to complete. Returns nil if the check has not finished, the current version is not parseable, or an error occurred.
type Option ¶
type Option func(*Checker)
Option configures a Checker.
func WithAPIBaseURL ¶
WithAPIBaseURL overrides the GitHub API base URL (for testing).
func WithCacheDir ¶
WithCacheDir overrides the default cache directory.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client (useful for testing).