Skip to content

Commit

Permalink
Build: Update version string format
Browse files Browse the repository at this point in the history
  • Loading branch information
zsrv committed Feb 12, 2023
1 parent 05d2a78 commit 1806a1b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ import (
"runtime"
)

var buildVersion = "dev"
var buildVersion = "1.0.0"
var buildCommit string
var buildDate string
var buildDate = "unknown"
var builtBy string

// Version returns build information added during the build process.
func Version() string {
result := buildVersion
if buildCommit != "" {
result = fmt.Sprintf("%s\ncommit: %s", result, buildCommit)
result = fmt.Sprintf("%s-%s", result, buildCommit)
}

result = fmt.Sprintf("%s %s/%s", result, runtime.GOOS, runtime.GOARCH)

if buildDate != "" {
result = fmt.Sprintf("%s\nbuild date: %s", result, buildDate)
result = fmt.Sprintf("%s BuildDate=%s", result, buildDate)
}

if builtBy != "" {
result = fmt.Sprintf("%s\nbuilt by: %s", result, builtBy)
result = fmt.Sprintf("%s BuiltBy=%s", result, builtBy)
}
result = fmt.Sprintf("%s\ngoos: %s\ngoarch: %s", result, runtime.GOOS, runtime.GOARCH)

return result
}

0 comments on commit 1806a1b

Please sign in to comment.