feat: always retrieve version from git tag
This commit is contained in:
parent
5e559afdaf
commit
a041501eaf
1 changed files with 17 additions and 4 deletions
|
@ -1,7 +1,20 @@
|
||||||
package metadata
|
package metadata
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
// This will be overwritten by goreleaser on build
|
var (
|
||||||
var GoTomatoVersion = "devel" // The GoTomato version
|
GoTomatoVersion = "" // The GoTomato version
|
||||||
var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol 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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue