version

package
v0.2.0-rc.1 Latest Latest
Warning

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

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

Documentation

Overview

Package version provides build-time version information for the CLI. Variables are populated via ldflags during the build process.

Example build command:

go build -ldflags "-X github.com/StackEye-IO/stackeye-cli/internal/version.Version=1.0.0 \
  -X github.com/StackEye-IO/stackeye-cli/internal/version.Commit=$(git rev-parse --short HEAD) \
  -X github.com/StackEye-IO/stackeye-cli/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
  -X github.com/StackEye-IO/stackeye-cli/internal/version.BuiltBy=makefile"

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the semantic version of the CLI (e.g., "1.0.0", "1.0.0-dirty").
	// Set via: -X github.com/StackEye-IO/stackeye-cli/internal/version.Version=...
	Version = "dev"

	// Commit is the short git commit SHA at build time.
	// Set via: -X github.com/StackEye-IO/stackeye-cli/internal/version.Commit=...
	Commit = "none"

	// Date is the UTC timestamp when the binary was built.
	// Set via: -X github.com/StackEye-IO/stackeye-cli/internal/version.Date=...
	Date = "unknown"

	// BuiltBy indicates how the binary was built (e.g., "goreleaser", "makefile", "go install").
	// Set via: -X github.com/StackEye-IO/stackeye-cli/internal/version.BuiltBy=...
	BuiltBy = "unknown"
)

Build information variables, set via ldflags at compile time.

Functions

func IsDev

func IsDev() bool

IsDev returns true if this is a development build.

func IsDirty

func IsDirty() bool

IsDirty returns true if the build was from a dirty working directory.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	Date      string `json:"date"`
	BuiltBy   string `json:"builtBy"`
	GoVersion string `json:"goVersion"`
	Platform  string `json:"platform"`
}

Info holds structured version information.

func GetInfo

func GetInfo() Info

GetInfo returns structured version information.

func (Info) Short

func (i Info) Short() string

Short returns just the version string.

func (Info) String

func (i Info) String() string

String returns a formatted multi-line version string.

Jump to

Keyboard shortcuts

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