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

update

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotNewer = errors.New("installed version is already up to date")

ErrNotNewer means the installed binary is already at or past the release: another updater ran after this release was checked.

Functions

func Apply

func Apply(ctx context.Context, url string) error

Apply downloads the binary from url, verifies it, and replaces the currently running executable. The caller should restart after Apply returns.

func ApplyTo

func ApplyTo(ctx context.Context, rawURL, exe string) error

func CleanupOld

func CleanupOld()

CleanupOld removes leftover .old files from a previous update (Windows).

func ExecutablePath

func ExecutablePath() (string, error)

func HandleRestartHelper

func HandleRestartHelper(args []string) (handled bool, code int)

HandleRestartHelper runs the hidden restart helper command. It returns handled=false when args do not name the helper command.

func Restart

func Restart(exe string) error

Restart launches a detached helper from the updated binary and returns. The helper starts the replacement tray after the current process exits, so the desktop tray watcher sees a clean unregister/register sequence.

func TrustedComment added in v0.40.0

func TrustedComment(tag string) string

TrustedComment is the signed comment a release signature must carry. Binding the tag stops an old signed release being replayed under a new tag.

func VerifySums added in v0.40.0

func VerifySums(sums, sig []byte, tag string) error

VerifySums checks that sig is a valid signature over sums by a trusted key and that its signed comment names tag. The key is chosen by the key ID in the signature; an unknown ID fails.

func VerifySumsWith added in v0.40.0

func VerifySumsWith(keys []minisign.PublicKey, sums, sig []byte, tag string) error

VerifySumsWith is VerifySums against an explicit key set, for tests.

Types

type Release

type Release struct {
	Version string
	URL     string
}

func Check

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

Check queries GitHub for the latest release and returns it if newer than currentVersion. Returns nil if already up to date.

Jump to

Keyboard shortcuts

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