nats migration
This commit is contained in:
+26
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user