31 lines
750 B
Go
31 lines
750 B
Go
// Package version exposes host CLI build identity without requiring an installation descriptor.
|
|
package version
|
|
|
|
import "runtime"
|
|
|
|
var (
|
|
semanticVersion = "0.0.0-dev"
|
|
commit = "unknown"
|
|
buildTime = "unknown"
|
|
)
|
|
|
|
// Info is the stable, machine-readable identity of the host-side CLI.
|
|
type Info struct {
|
|
Version string `json:"version"`
|
|
Commit string `json:"commit"`
|
|
BuildTime string `json:"buildTime"`
|
|
OS string `json:"os"`
|
|
Arch string `json:"arch"`
|
|
}
|
|
|
|
// Current returns linker-overridable build metadata plus the executing host platform.
|
|
func Current() Info {
|
|
return Info{
|
|
Version: semanticVersion,
|
|
Commit: commit,
|
|
BuildTime: buildTime,
|
|
OS: runtime.GOOS,
|
|
Arch: runtime.GOARCH,
|
|
}
|
|
}
|