updates

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package updates asks GitHub for the latest Buggregator server release so the UI can say that a new version is out.

One GET of releases/latest at start and then every interval (12 h by default); a failed check waits an hour, never less. The check is optional: it never blocks start, only logs at debug level, and makes no network call when switched off or when the running build has no release version (dev).

Index

Constants

View Source
const (
	DefaultInterval = 12 * time.Hour
)
View Source
const LatestURL = "https://api.github.com/repos/buggregator/server/releases/latest"

LatestURL is the GitHub API for the newest published (non-draft, non-prerelease) server release.

Variables

View Source
var ErrNotRelease = errors.New("not a release build")

ErrNotRelease is CheckNow's answer for a build without a release version.

Functions

func IsRelease added in v2.11.0

func IsRelease(v string) bool

IsRelease reports whether v is a release version (not "dev").

Types

type Checker

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

Checker keeps the result of the last successful check.

func New

func New(current string, interval time.Duration) *Checker

New returns a checker for the running version. interval <= 0 means the default; anything below an hour is raised to an hour.

func (*Checker) CheckNow added in v2.11.0

func (c *Checker) CheckNow(ctx context.Context) error

CheckNow checks at once, outside the schedule.

func (*Checker) Current added in v2.11.0

func (c *Checker) Current() string

Current is the running version without a leading v.

func (*Checker) Release added in v2.11.0

func (c *Checker) Release() Release

Release returns the notes and assets of the last successful check.

func (*Checker) Run

func (c *Checker) Run(ctx context.Context)

Run checks at once and then on schedule until ctx ends. A build without a release version (dev) never checks.

func (*Checker) SetURL added in v2.11.0

func (c *Checker) SetURL(u string)

SetURL points the checker at another releases/latest endpoint (a mirror or a test server). Empty keeps the GitHub one.

func (*Checker) Status

func (c *Checker) Status() Status

Status returns the last known result.

type Release added in v2.11.0

type Release struct {
	Notes  string
	Assets map[string]string
}

Release is what self-update needs from the last successful check: the notes and the download URL of each asset by name.

type Status

type Status struct {
	Current   string     `json:"current"`
	Latest    string     `json:"latest,omitempty"`     // newest release, without a leading v
	URL       string     `json:"url,omitempty"`        // its release page
	Available bool       `json:"available"`            // Latest is newer than Current
	CheckedAt *time.Time `json:"checked_at,omitempty"` // last successful check
}

Status is what the UI reads.

Jump to

Keyboard shortcuts

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