1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

fix: make version semver compliant

This commit is contained in:
Pete Davison
2025-04-11 09:04:03 +00:00
parent 38b42d0fb1
commit 8c8b1b5f3b

View File

@@ -53,15 +53,15 @@ func GetVersion() string {
// the commit hash and dirty status if available. This will only work when built
// within inside of a Git checkout.
func GetVersionWithBuildInfo() string {
var buildInfo string
var buildMetadata []string
if commit != "" {
buildInfo += commit
buildMetadata = append(buildMetadata, commit)
}
if dirty {
buildInfo += "-dirty"
buildMetadata = append(buildMetadata, "dirty")
}
if buildInfo != "" {
return version + "-" + buildInfo
if len(buildMetadata) > 0 {
return version + "+" + strings.Join(buildMetadata, ".")
}
return version
}