feat(metadata): move version string to version.txt

- create version.txt to store the version number
- add function to read version from version.txt
- replace hardcoded version with dynamic retrieval
This commit is contained in:
Sebastian Mark 2024-11-08 12:31:56 +01:00
parent 7e7c46dc4c
commit 7187ebbdc1
2 changed files with 13 additions and 3 deletions

View file

@ -1,7 +1,16 @@
package metadata package metadata
import "strings" import (
"os"
"strings"
)
// This will be overwritten by goreleaser on build func getVersion() string {
var GoTomatoVersion = "devel" // The GoTomato version content, _ := os.ReadFile("version.txt")
version := strings.TrimSpace(string(content))
return version
}
var GoTomatoVersion = getVersion() // The GoTomato version
var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version

1
version.txt Normal file
View file

@ -0,0 +1 @@
devel