update

package
v4.24.37 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAsset

func FindAsset(release *Release) string

FindAsset returns the download URL for the current OS/arch from the release assets.

func RecordUpdateCheck

func RecordUpdateCheck()

RecordUpdateCheck writes the current timestamp to the state file.

func ShouldCheckForUpdate

func ShouldCheckForUpdate() bool

ShouldCheckForUpdate returns true if the last update check was more than 24 hours ago (or if the state file doesn't exist).

func Update

func Update(currentVersion, commit string) error

Update performs a self-update of the binary.

Types

type Asset

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

Asset represents a downloadable file from a GitHub release.

type InstallMethod

type InstallMethod int

InstallMethod describes how the binary was installed.

const (
	MethodSourceBuild InstallMethod = iota
	MethodGoInstall
	MethodPrebuilt
)

func DetectInstallMethod

func DetectInstallMethod(version, commit string) InstallMethod

DetectInstallMethod determines how the binary was installed.

type Release

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

Release represents the relevant fields from a GitHub release.

func CheckLatest

func CheckLatest() (*Release, error)

CheckLatest fetches the latest release from GitHub and returns it.

type Version

type Version struct {
	Major      int
	Minor      int
	Patch      int
	PreRelease string // e.g. "dev", "rc1"
}

Version represents a parsed semantic version.

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses a version string like "1.2.3", "v1.2.3", or "1.2.3-dev".

func (Version) Compare

func (v Version) Compare(other Version) int

Compare returns -1, 0, or 1 comparing v to other. Pre-release versions are considered older than the same version without pre-release.

func (Version) IsNewerThan

func (v Version) IsNewerThan(other Version) bool

IsNewerThan returns true if v is strictly newer than other.

func (Version) String

func (v Version) String() string

String returns the version as "X.Y.Z" or "X.Y.Z-pre".

Jump to

Keyboard shortcuts

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