update

package
v1.27.3 Latest Latest
Warning

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

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

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 added in v1.10.0

func RecordUpdateCheck()

RecordUpdateCheck writes the current timestamp to the state file.

func ShouldCheckForUpdate added in v1.10.0

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