version

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "unknown"
	Commit    = "unknown"
	BuildDate = "unknown"
)

Build-time variables set via -ldflags

Functions

func Branch added in v0.2.1

func Branch() string

Branch returns the branch name if the binary was built from a branch (e.g. "main:abc123"). Returns the tag name for tagged releases (e.g. "v0.2.0"), and empty for unknown versions.

Types

type Info

type Info struct {
	Version   string    `json:"version"`
	Commit    string    `json:"commit"`
	BuildDate time.Time `json:"build_date"`
}

Info represents version information

func GetInfo

func GetInfo() Info

GetInfo returns the current version information

func (Info) IsNewer

func (i Info) IsNewer(other Info) bool

IsNewer returns true if this version info is newer than the other

func (Info) JSON

func (i Info) JSON() (string, error)

JSON returns the version info as JSON

func (Info) String

func (i Info) String() string

String returns the version info as a formatted string

Jump to

Keyboard shortcuts

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