update

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(repoURL string, release *Release, token string) error

Install downloads the release asset for the current OS/arch, verifies its SHA256 checksum against checksums.txt, and replaces the running binary. token is an optional Bearer token for GitHub Enterprise authentication; pass "" if not needed.

func RecordCheck

func RecordCheck(cacheDir string) error

RecordCheck writes the current time to the cache file. Only called after a successful response from CheckLatest (not on network errors).

func ShouldCheck

func ShouldCheck(cacheDir string, ttl time.Duration) bool

ShouldCheck returns true if enough time has passed since the last update check. Returns true if the cache file is missing or unreadable (fail-open).

Types

type Release

type Release struct {
	Version string // e.g. "1.2.0" (no leading "v")
	TagName string // e.g. "v1.2.0"
}

Release holds the relevant fields from a GitHub release.

func CheckLatest

func CheckLatest(repoURL, currentVersion, token string) (*Release, bool, error)

CheckLatest fetches the latest GitHub release and returns it along with whether it is newer than currentVersion. token is an optional Bearer token for GitHub Enterprise authentication; pass "" if not needed. Returns a real error on failure — callers decide whether to surface or swallow it.

Jump to

Keyboard shortcuts

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