update

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package update provides self-update functionality for cern-sso-cli.

Index

Constants

View Source
const (
	// GitHubRepo is the repository path for releases.
	GitHubRepo = "clelange/cern-sso-cli"
	// GitHubAPIURL is the base URL for GitHub API.
	GitHubAPIURL = "https://api.github.com"
)

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(current, latest string) int

CompareVersions compares two version strings. Returns: -1 if current < latest, 0 if equal, 1 if current > latest. Handles "dev" as always older than any release version.

func DownloadBinary

func DownloadBinary(url string, progress func(downloaded, total int64)) ([]byte, error)

DownloadBinary downloads the binary from the given URL.

func FetchChecksums

func FetchChecksums(url string) (map[string]string, error)

FetchChecksums downloads and parses the checksums file.

func GetAssetForCurrentPlatform

func GetAssetForCurrentPlatform(release *ReleaseInfo) (binaryURL, checksumURL string, err error)

GetAssetForCurrentPlatform returns the download URL for the appropriate binary.

func GetExecutablePath

func GetExecutablePath() (string, error)

GetExecutablePath returns the resolved path to the current executable.

func IsHomebrewInstall

func IsHomebrewInstall() bool

IsHomebrewInstall checks if the binary appears to be installed via Homebrew.

func ReplaceBinary

func ReplaceBinary(newBinary []byte) error

ReplaceBinary atomically replaces the current executable with new binary data.

func VerifyChecksum

func VerifyChecksum(data []byte, expectedChecksum string) error

VerifyChecksum verifies the SHA256 checksum of the binary.

Types

type ReleaseAsset

type ReleaseAsset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

ReleaseAsset represents a downloadable asset from a GitHub release.

type ReleaseInfo

type ReleaseInfo struct {
	TagName string         `json:"tag_name"`
	Assets  []ReleaseAsset `json:"assets"`
}

ReleaseInfo contains information about a GitHub release.

func CheckForUpdate

func CheckForUpdate() (*ReleaseInfo, error)

CheckForUpdate queries GitHub for the latest release.

Jump to

Keyboard shortcuts

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