diff --git a/internal/metadata/version.go b/internal/metadata/version.go index 13b8f6e..6a9529b 100644 --- a/internal/metadata/version.go +++ b/internal/metadata/version.go @@ -1,16 +1,23 @@ package metadata import ( - "os" + "fmt" + "runtime/debug" "strings" ) -func getVersion() string { - content, _ := os.ReadFile("version.txt") - version := strings.TrimSpace(string(content)) +var ( + GoTomatoVersion = "" // The GoTomato version + ProtocolVersion = "" // The protocol version +) - return version +func init() { + info, ok := debug.ReadBuildInfo() + fmt.Printf("%v", info) + if !ok { + GoTomatoVersion = "unknown" + } + + GoTomatoVersion = info.Main.Version + ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] } - -var GoTomatoVersion = getVersion() // The GoTomato version -var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version diff --git a/version.txt b/version.txt deleted file mode 100644 index d64531f..0000000 --- a/version.txt +++ /dev/null @@ -1 +0,0 @@ -devel