Help us shape the future of Go! Take the 2026 Go Developer Survey

update

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatShortUpdateMessage

func FormatShortUpdateMessage(info *UpdateInfo) string

FormatShortUpdateMessage formats a brief update notification

func FormatUpdateMessage

func FormatUpdateMessage(info *UpdateInfo) string

FormatUpdateMessage formats a user-friendly update notification message

func GetUpdateCommand

func GetUpdateCommand(method InstallMethod) string

GetUpdateCommand returns the appropriate update command for the installation method

func GetUpdateInstructions

func GetUpdateInstructions(method InstallMethod, latestVersion string) string

GetUpdateInstructions returns detailed update instructions

Types

type CachedUpdateCheck

type CachedUpdateCheck struct {
	UpdateInfo *UpdateInfo   `json:"update_info"`
	CheckedAt  time.Time     `json:"checked_at"`
	CacheTTL   time.Duration `json:"cache_ttl"`
}

CachedUpdateCheck stores cached update check results

func (*CachedUpdateCheck) IsExpired

func (c *CachedUpdateCheck) IsExpired() bool

IsExpired checks if the cached update check has expired

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

Checker handles version checking and update notifications

func NewChecker

func NewChecker() (*Checker, error)

NewChecker creates a new update checker

func (*Checker) CheckForUpdates

func (c *Checker) CheckForUpdates(ctx context.Context) (*UpdateInfo, error)

CheckForUpdates checks if a new version is available

func (*Checker) ClearCache

func (c *Checker) ClearCache() error

ClearCache removes cached update check

type InstallMethod

type InstallMethod string

InstallMethod represents how Prism was installed

const (
	InstallMethodHomebrew InstallMethod = "homebrew"
	InstallMethodScoop    InstallMethod = "scoop"
	InstallMethodBinary   InstallMethod = "binary"
	InstallMethodSource   InstallMethod = "source"
	InstallMethodUnknown  InstallMethod = "unknown"
)

func DetectInstallMethod

func DetectInstallMethod() InstallMethod

DetectInstallMethod determines how Prism was installed

func (InstallMethod) String

func (im InstallMethod) String() string

String returns the string representation of the install method

type UpdateChannel

type UpdateChannel string

UpdateChannel represents release channel (stable/beta/dev)

const (
	ChannelStable UpdateChannel = "stable"
	ChannelBeta   UpdateChannel = "beta"
	ChannelDev    UpdateChannel = "dev"
)

type UpdateInfo

type UpdateInfo struct {
	CurrentVersion    string        `json:"current_version"`
	LatestVersion     string        `json:"latest_version"`
	IsUpdateAvailable bool          `json:"is_update_available"`
	ReleaseURL        string        `json:"release_url"`
	ReleaseNotes      string        `json:"release_notes"`
	PublishedAt       time.Time     `json:"published_at"`
	InstallMethod     InstallMethod `json:"install_method"`
	UpdateCommand     string        `json:"update_command"`
	LastChecked       time.Time     `json:"last_checked"`
}

UpdateInfo contains information about an available update

Jump to

Keyboard shortcuts

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