mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Ensure correct version string format
This commit is contained in:
parent
77fe8449ba
commit
a6eb690e31
@ -18,6 +18,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
@ -48,6 +49,14 @@ var (
|
|||||||
var l = logger.DefaultLogger
|
var l = logger.DefaultLogger
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
if Version != "unknown-dev" {
|
||||||
|
// If not a generic dev build, version string should come from git describe
|
||||||
|
exp := regexp.MustCompile(`^v\d+\.\d+\.\d+(-\d+-g[0-9a-f]+)?(-dirty)?$`)
|
||||||
|
if !exp.MatchString(Version) {
|
||||||
|
l.Fatalf("Invalid version string %q;\n\tdoes not match regexp %v", Version, exp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stamp, _ := strconv.Atoi(BuildStamp)
|
stamp, _ := strconv.Atoi(BuildStamp)
|
||||||
BuildDate = time.Unix(int64(stamp), 0)
|
BuildDate = time.Unix(int64(stamp), 0)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user