version

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package version is the single source of truth for the build version and a best-effort "is a newer release out?" check against the GitHub tags.

Index

Constants

View Source
const Repo = "Veyal/interceptor"

Repo is the GitHub owner/name used for the update check.

View Source
const Version = "0.28.0"

Version is the baked-in fallback version for dev builds. Release binaries report the real version from the module build info (the git tag) instead, so this constant deliberately tracks the last *published* release — bumping it ahead of the tag would break the update-check test, which verifies the named release actually exists on GitHub.

Variables

View Source
var ErrRestartRequired = errors.New("restart required to finish update")

ErrRestartRequired means the new binary is staged and the process should exit so a Windows updater script can replace the running executable.

Functions

func CheckLatest

func CheckLatest(ctx context.Context) (latest string, newer bool, err error)

CheckLatest queries GitHub for the latest release tag and reports whether it is newer than the running version. Best-effort: any error (offline, rate limit, etc.) returns ("", false, err) for the caller to ignore quietly.

func String

func String() string

String returns the running version: the module version when installed via `go install …@vX.Y.Z` (authoritative), otherwise the baked-in constant. It deliberately ignores "(devel)" and pseudo-versions (vX.Y.Z-0.<ts>-<hash>) from between-tags local builds, which would otherwise look ugly in the UI/logs.

func Update added in v0.8.0

func Update(ctx context.Context, opts UpdateOptions) error

Update checks GitHub for a newer (or requested) release and installs it. It prefers a prebuilt binary asset for the current OS/arch; if none is attached to the release it falls back to `go install` when the Go toolchain is available.

Types

type UpdateOptions added in v0.8.0

type UpdateOptions struct {
	Version string // empty = latest tag
	Check   bool   // only report availability
	Force   bool   // reinstall even when up to date
	Out     io.Writer
}

UpdateOptions configures a self-update run.

Jump to

Keyboard shortcuts

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