selfupdate

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package selfupdate replaces the running binary with the latest GitHub release after verifying its SHA-256 checksum.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNewer added in v1.2.0

func IsNewer(latest, current string) bool

IsNewer reports whether release version latest is strictly newer than the installed current. A plain string compare would "update" whenever the strings differ — downgrading a newer local/dev build, or re-installing an older release after the latest was yanked. semver.Compare needs a leading "v"; an unparseable current (e.g. a "dev" build) sorts below any real release, so it still updates.

Types

type Result

type Result struct {
	Updated bool
	From    string
	To      string
}

Result reports the outcome of a check/update.

func Available

func Available(ctx context.Context, current string) (Result, error)

Available reports whether a newer release exists (no changes applied).

func Run

func Run(ctx context.Context, current string) (Result, error)

Run downloads the latest release for this OS/arch, verifies its checksum and atomically replaces the current binary.

Jump to

Keyboard shortcuts

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