selfupdate

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package selfupdate checks GitHub for a newer release and installs it by running the app's own installer (install.sh, or install.ps1 in PowerShell) with BIN_DIR set to the running binary's directory. The latest tag comes from the /releases/latest redirect, which avoids the rate-limited API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, repo string, info Info, binDir string, report func(string, ...any)) error

Apply installs info.LatestTag into binDir by running the platform installer with VERSION pinned, streaming its output to report. Replacing the running binary is safe: the installers stage in a temp dir, and on Windows the running .exe is renamed aside.

func BinDir

func BinDir() (string, error)

BinDir is the running executable's directory, symlinks unresolved: a dev install is a symlink that the installer then replaces with the release binary.

func NewUpdateCommand

func NewUpdateCommand(repo, name, version string) *cobra.Command

NewUpdateCommand returns the shared `update` command: it compares the running version with repo's latest release and installs it in place. name is used in messages.

Types

type Info

type Info struct {
	Current   string
	LatestTag string
	Available bool
}

Info is the outcome of Check: the running version, the latest release tag, and whether the release is newer.

func Check

func Check(ctx context.Context, repo, current string) (Info, error)

Check resolves repo's latest release tag and reports whether it is newer than current. A "dev" build is never offered an update.

Jump to

Keyboard shortcuts

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