2024-10-22 15:18:05 +00:00
|
|
|
package metadata
|
|
|
|
|
2024-11-09 14:59:30 +00:00
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"strings"
|
|
|
|
)
|
2024-10-27 21:46:58 +00:00
|
|
|
|
2024-11-09 14:59:30 +00:00
|
|
|
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.Replace(trimmed_output, "v", "", 1) // strip leading "v"
|
|
|
|
}
|
|
|
|
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
|
|
|
|
}
|