update

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 14 Imported by: ? 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

View Source
const CacheTTL = 4 * time.Hour

Variables

This section is empty.

Functions

func AssetCandidates

func AssetCandidates(platform ReleasePlatform) []string

func CompareVersions

func CompareVersions(v1, v2 string) int

func GetDefaultCachePath

func GetDefaultCachePath() string

func IsCacheFresh

func IsCacheFresh(cache *UpdateCache, ttl time.Duration) bool

func NormalizeReleaseVersion

func NormalizeReleaseVersion(tag string) string

func ReadCachedUpdateNotice

func ReadCachedUpdateNotice(path string, currentVersion string) (string, bool)

func ReleaseChannel

func ReleaseChannel(version string, prerelease bool) string

func SpawnUpdateWorker

func SpawnUpdateWorker(execPath string, args ...string) error

func WriteCache

func WriteCache(path string, cache *UpdateCache) error

Types

type GitHubAsset

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

type GitHubRelease

type GitHubRelease struct {
	TagName     string        `json:"tag_name"`
	Draft       bool          `json:"draft"`
	Prerelease  bool          `json:"prerelease"`
	PublishedAt *string       `json:"published_at"`
	CreatedAt   *string       `json:"created_at"`
	Assets      []GitHubAsset `json:"assets"`
}

type ReleaseAsset

type ReleaseAsset struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

func FindCompatibleAsset

func FindCompatibleAsset(release GitHubRelease, platform ReleasePlatform) *ReleaseAsset

type ReleaseCatalog

type ReleaseCatalog struct {
	SchemaVersion       int                   `json:"schemaVersion"`
	Command             string                `json:"command"`
	CurrentVersion      string                `json:"currentVersion"`
	LatestStableVersion string                `json:"latestStableVersion"`
	Releases            []ReleaseCatalogEntry `json:"releases"`
}

func FetchReleaseCatalog

func FetchReleaseCatalog(apiURL string, platform ReleasePlatform, currentVersion string, client *http.Client) (*ReleaseCatalog, error)

type ReleaseCatalogEntry

type ReleaseCatalogEntry struct {
	Tag             string        `json:"tag"`
	Version         string        `json:"version"`
	Channel         string        `json:"channel"`
	Prerelease      bool          `json:"prerelease"`
	PublishedAt     *string       `json:"publishedAt"`
	Current         bool          `json:"current"`
	LatestStable    bool          `json:"latestStable"`
	CompatibleAsset *ReleaseAsset `json:"compatibleAsset"`
}

type ReleasePlatform

type ReleasePlatform struct {
	OS      string
	Arch    string
	Variant string
}

func ResolveUpgradePlatform

func ResolveUpgradePlatform(goos, goarch string) (ReleasePlatform, error)

type UpdateCache

type UpdateCache struct {
	NewVersionAvailable bool   `json:"newVersionAvailable"`
	LatestVersion       string `json:"latestVersion"`
	UpgradeCommand      string `json:"upgradeCommand,omitempty"`
	LastCheck           string `json:"lastCheck"`
}

func ReadCache

func ReadCache(path string) (*UpdateCache, error)

func RunUpdateWorker

func RunUpdateWorker(opts WorkerOptions) (*UpdateCache, error)

type WorkerOptions

type WorkerOptions struct {
	CachePath      string
	CurrentVersion string
	GOOS           string
	GOARCH         string
	APIURL         string
	HTTPClient     *http.Client
	Timeout        time.Duration
	Now            func() time.Time
}

Jump to

Keyboard shortcuts

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