Documentation
¶
Overview ¶
Package version implements the "version" CLI command.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the application version string. When built from a tagged release or installed via "go install", the Go toolchain embeds the module version automatically, and it is read from build info at startup. Override at link time only if the auto-detected value is incorrect:
go build -ldflags "-X 'github.com/StevenACoffman/gorouter/cmd/version.Version=v1.2.3'"
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
GitVersion string `json:"gitVersion"`
ModuleSum string `json:"moduleChecksum"`
GitCommit string `json:"gitCommit"`
GitTreeState string `json:"gitTreeState"`
BuildDate string `json:"buildDate"`
BuiltBy string `json:"builtBy"`
GoVersion string `json:"goVersion"`
Compiler string `json:"compiler"`
Platform string `json:"platform"`
ASCIIName string `json:"-"`
Name string `json:"-"`
Description string `json:"-"`
URL string `json:"-"`
}
Info holds build and VCS metadata for structured output.
func GetVersionInfoFrom ¶
GetVersionInfoFrom builds an Info from an explicit BuildInfo value. Passing nil returns an Info with all VCS fields set to "unknown" and current runtime values for GoVersion, Compiler, and Platform. This is useful for testing without touching global state.
func (*Info) JSONString ¶
JSONString returns the JSON representation of the version info.
type Option ¶
type Option func(i *Info)
Option can be used to customize the Info after it is gathered from the environment.
func WithASCIIName ¶
WithASCIIName allows you to add an ASCII art of the name.
func WithAppDetails ¶
WithAppDetails allows setting the app name and description.
func WithBuiltBy ¶
WithBuiltBy allows to set the builder name/builder system name.