update

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(v1, v2 string) int

CompareVersions compares two semver versions Returns: -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2

func DownloadAndReplace

func DownloadAndReplace(ctx context.Context, asset *Asset, progress ProgressCallback) error

DownloadAndReplace downloads a new binary and replaces the current one

func VerifyChecksum

func VerifyChecksum(filePath, expectedChecksum string) error

VerifyChecksum verifies the SHA256 checksum of a file

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
	Size               int64  `json:"size"`
	ContentType        string `json:"content_type"`
}

Asset represents a release asset

type ProgressCallback

type ProgressCallback func(downloaded, total int64)

ProgressCallback is called to report download progress

type Release

type Release struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	Body        string    `json:"body"`
	HTMLURL     string    `json:"html_url"`
	PublishedAt time.Time `json:"published_at"`
	Assets      []Asset   `json:"assets"`
}

Release represents a GitHub release

func GetLatestRelease

func GetLatestRelease(ctx context.Context) (*Release, error)

GetLatestRelease fetches the latest release from GitHub

func (*Release) GetAssetForPlatform

func (r *Release) GetAssetForPlatform() (*Asset, error)

GetAssetForPlatform returns the download asset for the current platform

func (*Release) GetVersion

func (r *Release) GetVersion() string

GetVersion extracts the version from a tag name (e.g., "v1.2.3" -> "1.2.3")

Jump to

Keyboard shortcuts

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