Documentation
¶
Overview ¶
Package install detects how the running truestamp binary was installed. The detection is best-effort: it inspects the resolved executable path, Go build metadata, and environment variables. Callers use the result to decide whether `truestamp upgrade` should perform an in-place replace or print a package-manager-specific instruction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GOOS = func() string { return runtime.GOOS }
GOOS returns runtime.GOOS. Exposed as a function so tests can stub it.
Functions ¶
func BinaryWritable ¶
func BinaryWritable() bool
BinaryWritable reports whether the current user can write a new binary into the directory containing the running executable. Used to decide whether an Unknown install method can be handled by in-place replace.
func Executable ¶
func Executable() string
Executable returns the resolved path (symlinks followed) of the running binary used during detection. Empty string if detection couldn't resolve.
Types ¶
type Method ¶
type Method int
Method is how the truestamp binary was installed.
const ( // Unknown is used when the binary path does not match any known // install location and no Go build metadata points to `go install`. Unknown Method = iota // Homebrew means the binary lives under a Homebrew prefix // (/opt/homebrew, /usr/local/Cellar, /home/linuxbrew/.linuxbrew). Homebrew // GoInstall means the binary was produced by `go install` — detected // via Go build metadata and/or path under $GOBIN or $GOPATH/bin. GoInstall // InstallScript means the binary was placed by install.sh (or a // manual tarball extraction) into a standard user-writable path. InstallScript )
func Detect ¶
func Detect() Method
Detect classifies the running binary. Result is cached for the lifetime of the process.
func (Method) String ¶
String returns a user-facing label. Zero-value Unknown prints "unknown" so version output stays readable.
func (Method) UpgradeCommand ¶
UpgradeCommand returns the command the user should run to upgrade this install method. Empty string for methods the upgrade command performs in-place (InstallScript, Unknown-but-writable).