瀏覽代碼

build: Replace hypen in -dirty for version (ref #6758) (#6858)

Simon Frei 5 年之前
父節點
當前提交
21dd9d6b43
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      build.go

+ 4 - 1
build.go

@@ -874,7 +874,10 @@ func getGitVersion() (string, error) {
 	}
 	v0 := string(bs)
 
-	versionRe := regexp.MustCompile(`-([0-9]{1,3}-g[0-9a-f]{5,10})`)
+	// To be more semantic-versionish and ensure proper ordering in our
+	// upgrade process, we make sure there's only one hypen in the version.
+
+	versionRe := regexp.MustCompile(`-([0-9]{1,3}-g[0-9a-f]{5,10}(-dirty)?)`)
 	if m := versionRe.FindStringSubmatch(vcur); len(m) > 0 {
 		suffix := strings.ReplaceAll(m[1], "-", ".")