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 }