Help us shape the future of Go! Take the 2026 Go Developer Survey

update

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const RefreshCommand = "__refresh-update-cache"

RefreshCommand is an internal helper that survives the client's exec handoff.

View Source
const RefreshForkCommand = "__refresh-update-cache-fork"

RefreshForkCommand is the short-lived intermediate that detaches the refresh helper. StartCacheRefresh waits for the intermediate rather than the helper, so the helper is reparented before al replaces itself with the client.

View Source
const ReleasesBaseURL = "https://github.com/" + Repo + "/releases"

ReleasesBaseURL is the base URL for release downloads.

View Source
const Repo = "conn-castle/agent-layer"

Repo identifies the GitHub repository used for release checks.

Variables

This section is empty.

Functions

func IsRateLimitError added in v0.8.0

func IsRateLimitError(err error) bool

IsRateLimitError reports whether err represents a GitHub API rate-limit condition.

func RefreshCache added in v1.0.0

func RefreshCache(ctx context.Context)

RefreshCache has one short deadline shared by all requests and retry waits. Launch callers gate update suppression and version overrides before spawning.

func SpawnDetachedRefresh added in v1.0.0

func SpawnDetachedRefresh()

SpawnDetachedRefresh starts the real refresh helper and returns immediately without waiting for it. It runs in the short-lived fork intermediate: the helper reparents to init when the intermediate exits, so no Wait goroutine must survive the client's exec handoff.

func StartCacheRefresh added in v1.0.0

func StartCacheRefresh()

StartCacheRefresh starts a silent, isolated helper without waiting for GitHub. A goroutine alone cannot finish after al replaces itself with the client, and a direct child would stay a zombie once exec destroys the waiting goroutine. The helper is therefore double-forked: this process waits only for a short-lived intermediate that detaches the real helper before the exec handoff, and concurrent launches share one attempt claim from before the spawn. The wait covers the intermediate only, never the helper's network I/O.

Types

type CheckResult

type CheckResult struct {
	Current      string
	Latest       string
	Outdated     bool
	CurrentIsDev bool
}

CheckResult captures the latest release check outcome.

func CachedCheck added in v1.0.0

func CachedCheck(_ context.Context, currentVersion string) (CheckResult, error)

CachedCheck never performs network I/O. Stale data remains usable for a notice while a detached helper refreshes it for subsequent launches.

func Check

func Check(ctx context.Context, currentVersion string) (CheckResult, error)

Check fetches the latest release and compares it to the currentVersion. It returns the normalized versions along with an outdated flag.

type RateLimitError added in v0.8.0

type RateLimitError struct {
	StatusCode int
	Status     string
	Remaining  *int
}

RateLimitError indicates GitHub's API rate limit was hit while checking for updates.

Callers should generally treat this as a best-effort failure and suppress/minimize output.

func (*RateLimitError) Error added in v0.8.0

func (e *RateLimitError) Error() string

Jump to

Keyboard shortcuts

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