version

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get() string

Get returns the raw version string, defaulting to "SNAPSHOT".

func GetCommit added in v0.2.14

func GetCommit() string

GetCommit returns the short commit hash, or "unknown" if not set.

func GetDate added in v0.2.14

func GetDate() string

GetDate returns the build date, or "unknown" if not set.

func Set

func Set(v string)

Set stores the application version. Call from main() before HTTP clients are created.

func SetBuildInfo added in v0.2.14

func SetBuildInfo(c, d string)

SetBuildInfo stores commit hash and build date alongside the version.

func UserAgent

func UserAgent() string

UserAgent returns the formatted User-Agent: gcx/{version} ({os}/{arch}).

Types

type InfoData added in v0.2.14

type InfoData struct {
	Version   string `json:"version"   yaml:"version"`
	Commit    string `json:"commit"    yaml:"commit"`
	BuildDate string `json:"buildDate" yaml:"buildDate"`
	Go        string `json:"go"        yaml:"go"`
	OS        string `json:"os"        yaml:"os"`
	Arch      string `json:"arch"      yaml:"arch"`
}

InfoData holds structured version metadata for JSON/YAML serialization.

func Info added in v0.2.14

func Info() InfoData

Info returns a structured snapshot of all version metadata.

Jump to

Keyboard shortcuts

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