Documentation
¶
Overview ¶
Package version handles version checks and update notifications.
Index ¶
Constants ¶
const ( // GitHubReleaseURL is the URL for checking the latest release GitHubReleaseURL = "https://api.github.com/repos/bral/git-sweep-go/releases/latest" // DayInSeconds is the number of seconds in a day (for version check interval) DayInSeconds = 86400 )
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check(ctx context.Context, currentVersion string, cfg *config.Config) (bool, string, string, error)
Check checks if a new version is available and returns information about the update It follows these steps: 1. Checks if 24 hours have passed since last check 2. If so, queries GitHub API for latest version 3. Compares with current version 4. Updates config with check time and latest version 5. Returns information about available updates
func GetVersionFromBuildInfo ¶ added in v0.8.1
GetVersionFromBuildInfo returns the version extracted from build info if available This is useful when running with go install where ldflags might not be set
func ShowUpdateNotification ¶
func ShowUpdateNotification(currentVersion, latestVersion, releaseURL string)
ShowUpdateNotification displays a notification about an available update
Types ¶
type GitHubRelease ¶
GitHubRelease represents the GitHub API response for releases