selfupdate

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package selfupdate answers one question — is a newer release published? — with one GitHub API call a day, cached on disk. It never fails loudly: update notice is a courtesy, not a feature the tool depends on.

Index

Constants

This section is empty.

Variables

View Source
var APIBase = "https://api.github.com/repos/midagedev/gadak"

APIBase is the GitHub API origin + repo path for release lookups. Tests replace it with an httptest server URL.

Functions

func DropCache added in v0.16.0

func DropCache(dir string) error

DropCache removes the cached release so the next Check hits the network even inside the 24h TTL — what a person means by "check for updates now". A missing file is success. Callers must not rebuild the filename themselves: this package owns it, and a copy of the literal elsewhere would go on pointing at the old name after a rename here.

func Newer

func Newer(current, latest string) bool

Newer reports whether latest > current, comparing dotted numeric parts. Pre-release/dev suffixes are not newer than anything.

Types

type Info

type Info struct {
	Latest    string `json:"latest"`          // tag without leading v, e.g. "0.3.1"
	URL       string `json:"url"`             // release html_url
	Notes     string `json:"notes,omitempty"` // GitHub release body (markdown; render as plain text)
	CheckedAt string `json:"checked_at"`      // RFC3339 UTC
}

Info is the cached answer.

func Check

func Check(ctx context.Context, cacheDir, current string, enabled bool) (Info, bool)

Check returns the latest release info, from cache when fresh (<24h), else from GitHub. current=="0.0.0-dev" or cfg opt-out → ("", ok=false) without any network. Any error → ok=false, silently.

Jump to

Keyboard shortcuts

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