Develop #134

Merged
metal3d merged 15 commits from develop into master 2025-07-12 22:21:15 +00:00
Showing only changes of commit 2307ad667e - Show all commits

View File

@@ -13,15 +13,13 @@ var Version = "master" // changed at compile time
// katneary using `go install`, the version should be different. // katneary using `go install`, the version should be different.
func GetVersion() string { func GetVersion() string {
// try to get the semantic version from the Version variable (theorically set at compile time) // try to get the semantic version from the Version variable (theorically set at compile time)
reg := regexp.MustCompile(`^(.?\d+.\d+.\d+.*)|^release-.*`) if reg := regexp.MustCompile(`^v?\d+.\d+.\d+.*|^release-.*`); reg.MatchString(Version) {
if reg.MatchString(Version) {
return Version return Version
} }
// OK... let's try to get the version from the build info // OK... let's try to get the version from the build info
// get the version from the build info (when installed with go install) // get the version from the build info (when installed with go install)
v, ok := debug.ReadBuildInfo() if v, ok := debug.ReadBuildInfo(); ok {
if ok {
return v.Main.Version + "-" + v.GoVersion return v.Main.Version + "-" + v.GoVersion
} }