parse legacy version too

This commit is contained in:
Michael Barz
2022-05-23 11:04:38 +02:00
parent a70dc22597
commit 7c6aecc8a2
2 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -216,9 +216,9 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
"version": map[string]interface{}{ "version": map[string]interface{}{
"product": "Infinite Scale", "product": "Infinite Scale",
"edition": "Community", "edition": "Community",
"major": version.Parsed().Major(), "major": version.ParsedLegacy().Major(),
"minor": version.Parsed().Minor(), "minor": version.ParsedLegacy().Minor(),
"micro": version.Parsed().Patch(), "micro": version.ParsedLegacy().Patch(),
"string": version.LegacyString, "string": version.LegacyString,
}, },
}, },
+7 -6
View File
@@ -1,7 +1,6 @@
package version package version
import ( import (
"strconv"
"time" "time"
"github.com/Masterminds/semver" "github.com/Masterminds/semver"
@@ -50,9 +49,11 @@ func Parsed() *semver.Version {
return parsedVersion return parsedVersion
} }
// Long returns the legacy version with 4 number parts like 10.9.8.0 // ParsedLegacy returns the legacy version
func Long() string { func ParsedLegacy() *semver.Version {
return strconv.FormatInt(Parsed().Major(), 10) + "." + parsedVersion, err := semver.NewVersion(LegacyString)
strconv.FormatInt(Parsed().Minor(), 10) + "." + if err != nil {
strconv.FormatInt(Parsed().Patch(), 10) + "." + "0" return &semver.Version{}
}
return parsedVersion
} }