2020-09-02 17:18:08 +02:00
|
|
|
package internal
|
|
|
|
|
2020-10-14 13:51:06 +02:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
// the final version string
|
|
|
|
var version string
|
2020-09-02 17:18:08 +02:00
|
|
|
|
|
|
|
// -ldflags "-X github.com/matrix-org/dendrite/internal.branch=master"
|
|
|
|
var branch string
|
|
|
|
|
|
|
|
// -ldflags "-X github.com/matrix-org/dendrite/internal.build=alpha"
|
|
|
|
var build string
|
|
|
|
|
|
|
|
const (
|
|
|
|
VersionMajor = 0
|
2022-08-01 18:34:29 +02:00
|
|
|
VersionMinor = 9
|
2022-09-01 15:49:42 +02:00
|
|
|
VersionPatch = 6
|
2022-05-09 18:31:14 +02:00
|
|
|
VersionTag = "" // example: "rc1"
|
2020-09-02 17:18:08 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func VersionString() string {
|
2020-10-14 13:51:06 +02:00
|
|
|
return version
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
|
|
|
|
if VersionTag != "" {
|
|
|
|
version += "-" + VersionTag
|
2020-09-02 17:18:08 +02:00
|
|
|
}
|
2020-10-14 13:51:06 +02:00
|
|
|
parts := []string{}
|
2020-09-02 17:18:08 +02:00
|
|
|
if build != "" {
|
2020-10-14 13:51:06 +02:00
|
|
|
parts = append(parts, build)
|
|
|
|
}
|
|
|
|
if branch != "" {
|
|
|
|
parts = append(parts, branch)
|
|
|
|
}
|
|
|
|
if len(parts) > 0 {
|
|
|
|
version += "+" + strings.Join(parts, ".")
|
2020-09-02 17:18:08 +02:00
|
|
|
}
|
|
|
|
}
|