update

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIBaseURL = "https://api.github.com/repos/geodro/lerd"

APIBaseURL is the GitHub API base URL for the repo. Overridable in tests.

View Source
var ReleasesBaseURL = "https://github.com/geodro/lerd/releases"

ReleasesBaseURL is the base GitHub releases URL. Overridable in tests.

Functions

func FetchChangelog added in v0.9.0

func FetchChangelog(currentVersion, latestVersion string) (string, error)

FetchChangelog downloads CHANGELOG.md from GitHub and returns the sections for versions strictly greater than currentVersion and <= latestVersion. Returns an empty string and a non-nil error when the fetch fails.

func FetchLatestPrerelease added in v1.5.0

func FetchLatestPrerelease() (string, error)

FetchLatestPrerelease returns the latest pre-release tag from GitHub. Unlike FetchLatestVersion, this calls the GitHub API because the /releases/latest redirect only returns stable releases.

func FetchLatestVersion

func FetchLatestVersion() (string, error)

FetchLatestVersion returns the latest published release tag from GitHub.

func StripV

func StripV(v string) string

StripV removes a leading "v" from a version string.

func VersionGreaterThan added in v1.0.0

func VersionGreaterThan(a, b string) bool

VersionGreaterThan returns true if a > b, comparing "X.Y.Z[-pre]" version strings (without a leading "v") component-by-component as integers. Pre-release suffixes (e.g. "-beta.1", "-rc.1") are handled per semver: a release without a pre-release suffix is greater than one with the same core version, and pre-release suffixes are compared lexicographically.

func WriteUpdateCache added in v0.9.1

func WriteUpdateCache(version string)

WriteUpdateCache records version as the known latest in the on-disk cache, resetting the 24-hour TTL. Call this after a successful update so that lerd status / doctor stop showing a stale "update available" notice.

Types

type GithubReleaseForTest added in v1.5.0

type GithubReleaseForTest = githubRelease

GithubReleaseForTest is exported only so tests in other packages can build JSON fixtures. It is not part of the public API.

type UpdateInfo added in v0.9.0

type UpdateInfo struct {
	LatestVersion string // e.g. "v0.8.5"
	Changelog     string // relevant CHANGELOG.md sections (trimmed markdown)
}

UpdateInfo holds the result of a successful update check when a newer version exists.

func CachedUpdateCheck added in v0.9.0

func CachedUpdateCheck(currentVersion string) (*UpdateInfo, error)

CachedUpdateCheck returns update info when a newer version is available. Returns nil, nil if already on the latest version, or if the check fails silently (no network, GitHub unreachable, etc.). Network fetches are rate-limited to once per 24 hours via a cache file at config.UpdateCheckFile().

Jump to

Keyboard shortcuts

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