Package Version API
Version information management.
Info Struct
Section titled “Info Struct”type Info struct { Version string `json:"version"` Commit string `json:"commit"` BuildDate string `json:"buildDate"` GoVersion string `json:"goVersion"` OS string `json:"os"` Arch string `json:"arch"`}Holds build and runtime info.
Functions
Section titled “Functions”func Get() InfoReturns current version info, populated via ldflags.
String / Short
Section titled “String / Short”func (i Info) String() stringfunc (i Info) Short() stringFormatted output for CLI.
Build Process
Section titled “Build Process”Version info set at build time:
go build -ldflags "-X 'github.com/NguyenTrongPhuc552003/elmos/core/app/version.Version=1.0.0' -X 'github.com/NguyenTrongPhuc552003/elmos/core/app/version.Commit=$(git rev-parse HEAD)' -X 'github.com/NguyenTrongPhuc552003/elmos/core/app/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)'" -o build/elmos ./cmd/elmosUsed in Taskfile.yml.