update

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 18 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(ctx context.Context, w io.Writer, quiet bool) func()

CheckInBackground starts an update check in a goroutine and returns a function that waits briefly for the result and prints a one-line notice if a new version is available.

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