nats migration

This commit is contained in:
paulo committed 2021-11-11 11:07:20 -03:00
1 parent 5b590ab31b
commit 581b4def8a
7 files changed
+295 -52

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package ver
import (
"golang.org/x/mod/semver"
"log"
"os"
)
func EnsureVer(v string) {
build := os.Getenv("BUILD_VER")
if build == "" {
log.Printf("No BUILD_VER found - skipping verification")
return
}
if semver.Compare(build, v) < 0 {
log.Printf("Replay version is %s, lower than required. Should be minimum %s - aborting", build, v)
os.Exit(0)
}
if semver.Major(build) != semver.Major(v) {
log.Printf("Replay major version is %s, different from feature requirement: %s - aborting", build, v)
}
}
func Get() string {
build := os.Getenv("BUILD_VER")
return build
}