From 2307ad667e8fe4ca4b5cab846f398fab8c27e482 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Fri, 11 Jul 2025 09:17:33 +0200 Subject: [PATCH] chore(dev): changed how to test version - force release version check to use "v" (or not) as first character - one line condtion --- generator/version.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generator/version.go b/generator/version.go index 310bbf2..309c955 100644 --- a/generator/version.go +++ b/generator/version.go @@ -13,15 +13,13 @@ var Version = "master" // changed at compile time // katneary using `go install`, the version should be different. func GetVersion() string { // try to get the semantic version from the Version variable (theorically set at compile time) - reg := regexp.MustCompile(`^(.?\d+.\d+.\d+.*)|^release-.*`) - if reg.MatchString(Version) { + if reg := regexp.MustCompile(`^v?\d+.\d+.\d+.*|^release-.*`); reg.MatchString(Version) { return Version } // OK... let's try to get the version from the build info // get the version from the build info (when installed with go install) - v, ok := debug.ReadBuildInfo() - if ok { + if v, ok := debug.ReadBuildInfo(); ok { return v.Main.Version + "-" + v.GoVersion }