update

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvNoUpdateCheck = "TEAMCITY_NO_UPDATE"
	CheckInterval    = 24 * time.Hour
)

Variables

This section is empty.

Functions

func CheckInBackground

func CheckInBackground(w io.Writer, quiet bool) func()

CheckInBackground starts an update check in a goroutine and returns a function that, when called, waits briefly for the result and prints a one-line notice if a new version is available. The wait is bounded so slow networks don't delay command exit.

func IsCI

func IsCI() bool

func IsDisabled

func IsDisabled() bool

func IsNewer

func IsNewer(current, latest string) bool

func PrintNotice

func PrintNotice(w io.Writer, currentVersion string, r *ReleaseInfo)

func SaveState

func SaveState(s *State)

Types

type InstallMethod

type InstallMethod int
const (
	InstallUnknown InstallMethod = iota
	InstallHomebrew
	InstallApt
	InstallRPM
	InstallArch
	InstallScoop
	InstallChocolatey
	InstallWinGet
	InstallNPM
	InstallGoInstall
	InstallScript
)

func DetectInstallMethod

func DetectInstallMethod() InstallMethod

func (InstallMethod) String

func (m InstallMethod) String() string

func (InstallMethod) UpdateCommand

func (m InstallMethod) UpdateCommand() string

type ReleaseInfo

type ReleaseInfo struct {
	Version string
	URL     string
}

func Check

func Check(ctx context.Context) *ReleaseInfo

Check fetches the latest release (respecting the 24h throttle) and returns it if it's newer than the running version. Returns nil otherwise.

func LatestRelease

func LatestRelease(ctx context.Context) (*ReleaseInfo, error)

type State

type State struct {
	LastCheckedAt time.Time `json:"last_checked_at"`
	LatestVersion string    `json:"latest_version"`
	LatestURL     string    `json:"latest_url"`
}

func LoadState

func LoadState() *State

func (*State) IsStale

func (s *State) IsStale(interval time.Duration) bool

Jump to

Keyboard shortcuts

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