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

version

package
v0.57.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package version provides version information and update checking.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "v0.57.0"
	Commit  = "none"
	Date    = "unknown"
)

Build info set via ldflags during build.

Functions

func DetectInstallChannel added in v0.42.0

func DetectInstallChannel() string

DetectInstallChannel labels how the running binary was installed, as one of a small fixed set of values. It is meant for analytics: the label is deliberately low-cardinality and never carries a machine-specific path.

func IsDev

func IsDev() bool

IsDev returns true if running a development build.

func IsNewerRelease

func IsNewerRelease(otherVersion string) bool

IsNewerRelease reports whether otherVersion is newer than current version.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	Date      string `json:"date"`
	GoVersion string `json:"goVersion"`
}

Info holds current version information.

func GetInfo

func GetInfo() Info

GetInfo returns current version information.

type Manager

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

Manager handles version checking with caching.

func New

func New() *Manager

New creates a new version manager.

func (*Manager) CheckUpdate

func (m *Manager) CheckUpdate() (*UpdateInfo, error)

CheckUpdate checks for available updates from GitHub releases.

func (*Manager) ClearCache

func (m *Manager) ClearCache()

ClearCache invalidates the cached version info.

func (*Manager) GetResponse

func (m *Manager) GetResponse() (*Response, error)

GetResponse returns combined version and update info.

func (*Manager) GetResponseFallback

func (m *Manager) GetResponseFallback() *Response

GetResponseFallback returns basic version info without update check.

type Response

type Response struct {
	Info
	UpdateInfo
}

Combined version and update response.

type UpdateInfo

type UpdateInfo struct {
	LatestVersion   string    `json:"latestVersion"`
	UpdateAvailable bool      `json:"updateAvailable"`
	ReleaseURL      string    `json:"releaseUrl"`
	PublishedAt     time.Time `json:"publishedAt,omitempty"`
	ReleaseNotes    string    `json:"releaseNotes,omitempty"`
	InstallCommand  string    `json:"installCommand,omitempty"`
}

UpdateInfo holds information about available updates.

Jump to

Keyboard shortcuts

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