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:
parent
7e7c46dc4c
commit
7187ebbdc1
2 changed files with 13 additions and 3 deletions
|
@ -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
1
version.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
devel
|
Loading…
Reference in a new issue