feat: 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 6e19e43aa7
commit e9d8d2e2dd
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,16 @@
package metadata package metadata
import "strings" import (
"os"
"strings"
)
const GoTomatoVersion = "0.1.1" // 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 var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version

1
version.txt Normal file
View file

@ -0,0 +1 @@
devel