updatecheck

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 9 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

Overview

Package updatecheck tells a person running an old release that a newer one exists. The check is a convenience, so nothing here returns an error: a failed lookup or an unreadable cache means loupe says nothing.

Index

Constants

View Source
const (
	// Owner and Repo name the repository whose latest release is checked.
	Owner = "secondshift-labs"
	Repo  = "loupe"
	// Command is what a warning tells a person to run. It refuses an install it cannot update, with that install's fix.
	Command = "loupe update"
	// CheckInterval is the least time between lookups.
	CheckInterval = 24 * time.Hour
	// LookupTimeout is the most a lookup may add to a command.
	LookupTimeout = 2 * time.Second
	// DisableEnv, when set, stops the check, the warning and the notice.
	DisableEnv = "LOUPE_NO_UPDATE_CHECK"
)

Variables

This section is empty.

Functions

func Available

func Available(current, latest string) string

Available says that latest is newer than current, or returns nothing. It compares when read, not when cached, so an upgrade clears it at once.

func CachePath

func CachePath(root string) string

CachePath is a file at the data root, outside the runs directory that run.Walk lists.

func Cached

func Cached(path string) string

Cached returns the latest version from the last check, or nothing.

func Enabled

func Enabled(current string, getenv func(string) string) bool

Enabled is false for a build that is not a release and for a CI job, which pins its version on purpose.

func IsRelease

func IsRelease(version string) bool

IsRelease says that version is X.Y.Z, which only a release build carries.

func Refresh

func Refresh(ctx context.Context, path string, now time.Time, lookup Lookup)

Refresh looks up the latest release unless a check ran within CheckInterval. A failed lookup also counts as a check, so that an offline machine pays LookupTimeout at most once per interval.

Types

type Lookup

type Lookup func(ctx context.Context) (string, error)

Lookup returns the tag of the latest release.

Jump to

Keyboard shortcuts

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