updater

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupOldBinaries

func CleanupOldBinaries(binaryPath string)

CleanupOldBinaries removes .old files left by previous Windows updates.

func FindBinaryPath

func FindBinaryPath(name string) (string, error)

FindBinaryPath returns the absolute path of a binary using exec.LookPath.

func GetToken

func GetToken() string

GetToken returns a GitHub token from the GITHUB_TOKEN or GH_TOKEN environment variable.

func NeedsUpdate

func NeedsUpdate(current, latest string) bool

NeedsUpdate compares current version against the latest release tag. Both may optionally have a "v" prefix.

func UpdateBinary

func UpdateBinary(assetAPIURL, binaryPath, token string) error

UpdateBinary downloads the asset from its API URL and replaces the binary at binaryPath. For private repos, the token is required to authenticate the download.

Types

type Asset

type Asset struct {
	Name string `json:"name"`
	URL  string `json:"url"` // API URL for downloading (works with private repos)
}

func FindAsset

func FindAsset(release *Release, binaryName string) (*Asset, error)

FindAsset locates the correct asset for the given binary name and current OS/arch.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	Assets  []Asset `json:"assets"`
}

func CheckLatestVersion

func CheckLatestVersion(token string) (*Release, error)

CheckLatestVersion fetches the latest release from GitHub. Pass an empty token for public repos.

Jump to

Keyboard shortcuts

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