From f233bb5a61413aec28c5c1ab2089e5e4c86f6c59 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Fri, 8 Nov 2024 12:31:56 +0100 Subject: [PATCH] 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 --- internal/metadata/version.go | 15 ++++++++++++--- version.txt | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 version.txt diff --git a/internal/metadata/version.go b/internal/metadata/version.go index ecac17b..13b8f6e 100644 --- a/internal/metadata/version.go +++ b/internal/metadata/version.go @@ -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 diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..0ea3a94 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.2.0