Compare commits

...

2 commits

Author SHA1 Message Date
7187ebbdc1 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
2024-11-08 14:14:28 +01:00
7e7c46dc4c feat: update -version output 2024-11-07 20:58:14 +01:00
3 changed files with 14 additions and 4 deletions

View file

@ -28,7 +28,7 @@ func Start() {
// show server and protocl version and exit
if *showVersionFlag {
fmt.Println("Server-Version:", metadata.GoTomatoVersion)
fmt.Println("GoTomato", metadata.GoTomatoVersion)
fmt.Println("Protocol-Version:", metadata.ProtocolVersion)
os.Exit(0)
}

View file

@ -1,7 +1,16 @@
package metadata
import "strings"
import (
"os"
"strings"
)
// This will be overwritten by goreleaser on build
var GoTomatoVersion = "devel" // The GoTomato version
func getVersion() string {
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

1
version.txt Normal file
View file

@ -0,0 +1 @@
devel