GoTomato/internal/metadata/version.go

21 lines
507 B
Go
Raw Normal View History

package metadata
import (
"os/exec"
"strings"
)
var (
GoTomatoVersion = "" // The GoTomato version
ProtocolVersion = "" // The protocol version
)
func init() {
if GoTomatoVersion == "" {
output, _ := exec.Command("git", "describe", "--tags").Output()
trimmed_output := strings.TrimSpace(string(output)) // strip newlines
GoTomatoVersion = strings.TrimPrefix(trimmed_output, "v") // strip leading "v"
}
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
}