version

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the semantic version number
	Version = "1.2.3"

	// GitCommit is the git commit hash (injected at build time)
	GitCommit = "unknown"

	// GitBranch is the git branch (injected at build time)
	GitBranch = "unknown"

	// BuildDate is the build date (injected at build time)
	BuildDate = "unknown"

	// BuildUser is the user who built the binary (injected at build time)
	BuildUser = "unknown"
)

Functions

func GetBuildMethod added in v1.0.2

func GetBuildMethod() string

GetBuildMethod returns the method used to build this binary

func GetDetailedVersionString

func GetDetailedVersionString() string

GetDetailedVersionString returns a detailed version string for --version output

func GetVersion

func GetVersion() string

GetVersion returns the version string

func GetVersionString

func GetVersionString() string

GetVersionString returns a formatted version string

func IsDevelopment

func IsDevelopment() bool

IsDevelopment returns true if this is a development build

func IsRelease

func IsRelease() bool

IsRelease returns true if this is a release version (not a dev build)

Types

type Info

type Info struct {
	Version     string `json:"version"`
	GitCommit   string `json:"git_commit"`
	GitBranch   string `json:"git_branch"`
	BuildDate   string `json:"build_date"`
	BuildUser   string `json:"build_user"`
	GoVersion   string `json:"go_version"`
	Platform    string `json:"platform"`
	BuildMethod string `json:"build_method"` // "make", "go-install", or "unknown"
	VCSTime     string `json:"vcs_time"`     // VCS commit time
	VCSModified bool   `json:"vcs_modified"` // Whether VCS had uncommitted changes
}

Info contains version information

func GetInfo

func GetInfo() Info

GetInfo returns comprehensive version information

type VCSInfo added in v1.0.2

type VCSInfo struct {
	Revision string
	Time     string
	Modified bool
	Found    bool
}

VCSInfo contains version control information detected from build info

Jump to

Keyboard shortcuts

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