update

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package update checks whether a newer netscope release is available on GitHub and reports it to the UI. The actual download+swap is handled by the GUI app (desktop/updates_darwin.go), which restarts the daemon over its unix socket after replacing the bundle — no admin prompt needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Newer

func Newer(latest, current string) bool

Newer reports whether version `latest` is strictly greater than `current` under semver (ignoring a leading "v" and any pre-release suffix). If either side is not parseable (e.g. a "dev" build), it returns false so we never nag.

Types

type Checker

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

Checker periodically refreshes and caches an update Status.

func NewChecker

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

NewChecker builds a Checker. interval bounds how often GitHub is queried.

func (*Checker) Run

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

Run checks immediately, then on the interval, until ctx is cancelled.

func (*Checker) Status

func (c *Checker) Status() Status

Status returns the most recent cached status.

type Status

type Status struct {
	Current         string    `json:"current"`
	Latest          string    `json:"latest"`
	UpdateAvailable bool      `json:"updateAvailable"`
	URL             string    `json:"url"`      // release page (human-facing)
	AssetURL        string    `json:"assetUrl"` // app .zip download (in-app self-update)
	CheckedAt       time.Time `json:"checkedAt"`
}

Status is the cached result of an update check.

func Check

func Check(ctx context.Context, repo, current string) (Status, error)

Check queries the repo's latest GitHub release and compares it to current. A repo with no releases yields a non-error Status with UpdateAvailable=false.

Jump to

Keyboard shortcuts

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