update

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(current, latest string) int

CompareVersions compares two semantic version strings. Returns:

-1 if current < latest (update available)
 0 if current == latest (up to date)
 1 if current > latest (ahead of latest, e.g., dev build)

Handles versions with or without "v" prefix (v1.2.3 or 1.2.3)

func GetLatestVersion

func GetLatestVersion() (string, error)

GetLatestVersion fetches the latest release version from GitHub API. It returns the version tag (e.g., "v1.2.3") and any error encountered.

func IsConnectedToInternet

func IsConnectedToInternet() bool

IsConnectedToInternet performs a quick check to see if the user has internet connectivity. It tries to resolve a reliable DNS name (GitHub's) with a short timeout.

Types

type ReleaseInfo

type ReleaseInfo struct {
	TagName string `json:"tag_name"`
	Name    string `json:"name"`
	HTMLURL string `json:"html_url"`
}

ReleaseInfo represents the GitHub release information

type UpdateInfo

type UpdateInfo struct {
	CurrentVersion string
	LatestVersion  string
	UpdateURL      string
	HasUpdate      bool
}

UpdateInfo contains information about available updates

func CheckForUpdate

func CheckForUpdate(currentVersion string) (*UpdateInfo, error)

CheckForUpdate checks if a newer version is available. It first verifies internet connectivity, then fetches the latest version from GitHub. Returns UpdateInfo with details about the update, or an error if the check fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL