selfupdate

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 7 Imported by: 0 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 wraps creativeprojects/go-selfupdate to update the vigil binary from its GitHub releases, with checksum validation. Channel detection and service stop/restart orchestration live with the caller (internal/cli).

Index

Constants

View Source
const Slug = "simtabi/vigil"

Slug is the GitHub owner/repo releases are pulled from.

Variables

View Source
var ErrDevVersion = errors.New("this is a development build; self-update only works on released versions")

ErrDevVersion is returned when self-update is attempted on a dev build.

Functions

func ExecutablePath

func ExecutablePath() (string, error)

ExecutablePath returns the resolved (symlink-followed) path of this binary, which is the file that will be replaced on update.

func IsDev

func IsDev(v string) bool

IsDev reports whether a version string is an unreleased build (empty, "dev", or any snapshot/dev-tagged version like "0.0.0-dev+<sha>"). Self-update is refused for these.

Types

type Channel

type Channel int

Channel is how the binary was installed, which determines whether in-place self-update is appropriate.

const (
	// Standalone — installed via the install script, `vigil self install`, or a
	// downloaded release archive. Safe to self-update.
	Standalone Channel = iota
	// Homebrew — managed by `brew`.
	Homebrew
	// Scoop — managed by Scoop on Windows.
	Scoop
	// SystemPackage — installed via a Linux package manager (deb/rpm).
	SystemPackage
)

func DetectChannel

func DetectChannel(exePath string) Channel

DetectChannel guesses the install channel from the executable path.

func (Channel) Advice

func (c Channel) Advice() string

Advice returns guidance for updating via the detected package manager.

func (Channel) SelfUpdatable

func (c Channel) SelfUpdatable() bool

SelfUpdatable reports whether `vigil upgrade` should replace this binary.

func (Channel) String

func (c Channel) String() string

String returns the channel's identifier (for JSON output).

type Info

type Info struct {
	Current   string
	Latest    string
	Available bool
	Notes     string
}

Info summarizes a version check or applied update.

func Apply

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

Apply downloads the latest release (if newer) and replaces this binary, verifying the checksum. The caller must stop a running service first.

func Check

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

Check reports whether a newer release exists. It does not modify anything.

Jump to

Keyboard shortcuts

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