version

package
v1.32.1 Latest Latest
Warning

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

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

Documentation

Overview

Package version is the single source of truth for the running binary's version string. Both quil (TUI) and quild (daemon) call SetCurrent from their main.version ldflag sink during startup; runtime code reads via Current(). Parsed() and Compare() provide proper semver ordering so comparisons work across multi-digit components ("1.10.0" > "1.9.0").

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b string) (int, error)

Compare returns -1 if a<b, 0 if a==b, +1 if a>b by semver ordering. Pre-release and build suffixes are ignored: "1.2.3-rc1" compares equal to "1.2.3". Returns a non-nil error when either side is unparseable so callers can decide how to interpret (typically: skip the check or treat as mismatch depending on context).

func Current

func Current() string

Current returns the version set by SetCurrent, or the "dev" fallback for local builds where main.version was never overridden via ldflags.

func IsRelease

func IsRelease() bool

IsRelease reports whether Current() parses as a proper semver (i.e., this is a release build, not "dev" or an unstamped binary). Callers use this to decide whether version-negotiation logic should engage or be skipped.

func Parsed

func Parsed(v string) (major, minor, patch int, err error)

Parsed extracts the numeric major.minor.patch components from a semver-like string. Accepts "1.2.3", "1.2.3-rc1", "v1.2.3". Leading "v" and any pre-release or build suffix after the first "-" or "+" are stripped before parsing.

func SetCurrent

func SetCurrent(v string)

SetCurrent stores the binary's version. Call exactly once from main() early in startup, before any code path reads Current(). Whitespace is trimmed. An empty string is coerced to the fallback so Current() never returns "" (which would complicate version-response IPC payloads).

Types

This section is empty.

Jump to

Keyboard shortcuts

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