github.com/esnet/gdg@v0.6.1-0.20240412190737-6b6eba9c14d8/internal/version/version.go (about) 1 package version 2 3 import ( 4 "fmt" 5 "log/slog" 6 "runtime" 7 ) 8 9 // GitCommit returns the git commit that was compiled. This will be filled in by the compiler. 10 var GitCommit string 11 12 // Version returns current version. Set to release CICD 13 var Version = "DEVEL" 14 15 // BuildDate returns the date the binary was built 16 var BuildDate = "" 17 18 // GoVersion returns the version of the go runtime used to compile the binary 19 var GoVersion = runtime.Version() 20 21 // OsArch returns the os and arch used to build the binary 22 var OsArch = fmt.Sprintf("%s %s", runtime.GOOS, runtime.GOARCH) 23 24 func PrintVersionInfo() { 25 slog.Info(fmt.Sprintf("Build Date: %s", BuildDate)) 26 slog.Info(fmt.Sprintf("Git Commit: %s", GitCommit)) 27 slog.Info(fmt.Sprintf("Version: %s", Version)) 28 slog.Info(fmt.Sprintf("Go Version: %s", GoVersion)) 29 slog.Info(fmt.Sprintf("OS / Arch: %s", OsArch)) 30 }