version

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package version reports the running build version and checks GitHub for a newer release. Development builds (a prerelease or non-semver version) never reach the network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDev

func IsDev(v string) bool

IsDev reports whether v is a development build that must not check for updates. Only a clean release tag (vX.Y.Z, no prerelease or build metadata) checks.

Types

type Checker

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

Checker resolves the latest release, caching the result to avoid hammering the GitHub API (unauthenticated: 60 req/h). It is safe for concurrent use.

func NewChecker

func NewChecker(current string, enabled bool) *Checker

NewChecker returns a checker for the given build version. When enabled is false the remote check is skipped and only the local version is reported.

func (*Checker) Check

func (c *Checker) Check(ctx context.Context, force bool) Info

Check returns the current update status. It serves a cached result within the TTL; force bypasses the TTL but still honors a short floor so repeated clicks cannot spam the upstream API. Dev builds and a disabled checker never hit the network.

func (*Checker) Current

func (c *Checker) Current() string

Current returns the running build version.

type Info

type Info struct {
	Current         string     `json:"current"`
	Dev             bool       `json:"dev"`
	Latest          string     `json:"latest,omitempty"`
	UpdateAvailable bool       `json:"updateAvailable"`
	ReleaseURL      string     `json:"releaseUrl,omitempty"`
	CheckDisabled   bool       `json:"checkDisabled,omitempty"`
	CheckedAt       *time.Time `json:"checkedAt,omitempty"`
	Error           string     `json:"error,omitempty"`
}

Info is the version/update status returned to clients.

Jump to

Keyboard shortcuts

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