update

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUpToDate reports that no pending release exists.
	ErrUpToDate = errors.New("already up to date")
	// ErrSuperseded reports that the requested version is no longer the
	// newest pending release. Callers should re-check and show the fresh
	// release notes instead of installing something the user never saw.
	ErrSuperseded = errors.New("a newer release is available")
)

Functions

This section is empty.

Types

type FeedFormat

type FeedFormat struct {
	// contains filtered or unexported fields
}

FeedFormat is one release feed dialect. It dresses the request the way the feed wants it and maps the feed's JSON onto the neutral release model. Everything past that point, semver ordering, pending, checksums, download, swap, smoke test and notes rendering, is the same for every dialect.

func ParseFeedFormat

func ParseFeedFormat(name string) (FeedFormat, error)

ParseFeedFormat resolves the updateFeedFormat build flag. An unknown value is a build configuration error and refuses loudly: a silent fallback would read the feed with the wrong mapping and report no update forever.

type Release

type Release struct {
	Version   string `json:"version"`
	Name      string `json:"name"`
	Notes     string `json:"notes"`
	NotesHTML string `json:"notesHtml"`
	Date      string `json:"date"`
}

type Status

type Status struct {
	Current   string    `json:"current"`
	Latest    string    `json:"latest"`
	Available bool      `json:"available"`
	Writable  bool      `json:"writable"`
	Releases  []Release `json:"releases"`
}

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

func New

func New(current, feedURL string, format FeedFormat, dev bool) (*Updater, error)

New builds the updater for the running binary. feedURL is the release feed exactly as injected at build time, nothing here derives a URL from anything. format is the feed's dialect from ParseFeedFormat, and dev says whether this is a dev build, the only build the env override reaches, see resolveFeedURL.

func (*Updater) Apply

func (u *Updater) Apply(ctx context.Context, version string) error

Apply downloads and installs the release matching version, or the newest pending release when version is empty. It refreshes the release feed first, then installs exactly the resolved release, never silently something newer.

func (*Updater) ExePath

func (u *Updater) ExePath() string

func (*Updater) Restart

func (u *Updater) Restart() error

func (*Updater) Status

func (u *Updater) Status(ctx context.Context, force bool) Status

Jump to

Keyboard shortcuts

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