update

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package update reports whether a newer openobserve-cli release is available.

It is a passive, opt-in check: nothing here runs unless a caller (the root post-run notice, or `doctor`) explicitly invokes it. A failed check never returns an error — it degrades into an informational Status — so an offline or rate-limited environment never turns a routine command into a failure.

Index

Constants

View Source
const DefaultEndpoint = "https://api.github.com/repos/AngelMsger/openobserve-cli/releases/latest"

DefaultEndpoint is the GitHub API URL for the latest published release.

View Source
const EndpointEnv = "OPENOBSERVE_RELEASE_API"

EndpointEnv overrides DefaultEndpoint. It exists so tests (and the e2e harness) can point the check at a local server instead of GitHub.

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status struct {
	Current   string `json:"current"`
	Latest    string `json:"latest,omitempty"`
	Available bool   `json:"available"`
	Detail    string `json:"detail"`
}

Status is the outcome of an update check. It is always safe to render: a failed check sets Available=false and explains itself in Detail.

func Cached

func Cached(ctx context.Context, doer transport.Doer, cacheDir, current string) Status

Cached returns an update Status backed by a 24h on-disk cache in cacheDir. It is the per-command counterpart to Check: a fresh cache is served without any network call, and only on a miss/expiry does it perform one bounded lookup (bounded by the doer's own timeout) and rewrite the cache. A failed lookup falls back to any stale cache, and otherwise degrades to a non- available Status — it never blocks beyond the doer and never returns an error, so a routine command is never slowed or failed by the check.

func Check

func Check(ctx context.Context, doer transport.Doer, current string) Status

Check fetches the latest release and compares it with the running version. It never returns an error: a failed lookup is reported in Status.Detail.

Jump to

Keyboard shortcuts

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