updater

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package updater implements `shepherd update`: it checks the latest GitHub release, downloads the matching release archive, verifies its checksum, and atomically replaces the running executable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckInfo

type CheckInfo struct {
	Current   string `json:"current"`
	Latest    string `json:"latest"`
	Available bool   `json:"available"`
}

CheckInfo is the result of a cached update check.

func CachedCheck

func CachedCheck(ctx context.Context, repo, current string) CheckInfo

CachedCheck returns whether a newer release is available, using a 24h on-disk cache to avoid hitting the network on every invocation. It is best-effort: any error yields Available=false and never surfaces. Dev builds are never flagged as out of date.

type Result

type Result struct {
	Current   string `json:"current"`
	Latest    string `json:"latest"`
	UpToDate  bool   `json:"up_to_date"`
	Updated   bool   `json:"updated"`
	Asset     string `json:"asset,omitempty"`
	Path      string `json:"path,omitempty"`
	CheckOnly bool   `json:"check_only"`
}

Result describes the outcome of an update check/run.

func Update

func Update(ctx context.Context, repo, current string, checkOnly bool) (Result, error)

Update checks repo's latest release against current and, unless checkOnly, installs it over the running binary.

Jump to

Keyboard shortcuts

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