0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-11-18 15:50:52 +01:00
dendrite/internal/version.go

44 lines
769 B
Go
Raw Normal View History

package internal
import (
"fmt"
"strings"
)
// the final version string
var version string
// -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
2020-11-16 12:13:05 +01:00
VersionMinor = 3
2021-02-17 17:05:04 +01:00
VersionPatch = 10
VersionTag = "" // example: "rc1"
)
func VersionString() string {
return version
}
func init() {
version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
if VersionTag != "" {
version += "-" + VersionTag
}
parts := []string{}
if build != "" {
parts = append(parts, build)
}
if branch != "" {
parts = append(parts, branch)
}
if len(parts) > 0 {
version += "+" + strings.Join(parts, ".")
}
}