Skip to content

Commit 252d868

Browse files
authored
fix: Prefix buildinfo tag with "v" (#1256)
This fixes the format of production and development build tags.
1 parent d139a16 commit 252d868

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

buildinfo/buildinfo.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ func Version() string {
3333
revision = "+" + revision[:7]
3434
}
3535
if tag == "" {
36+
// This occurs when the tag hasn't been injected,
37+
// like when using "go run".
3638
version = "v0.0.0-devel" + revision
3739
return
3840
}
39-
if semver.Build(tag) == "" {
40-
tag += revision
41-
}
4241
version = "v" + tag
42+
// The tag must be prefixed with "v" otherwise the
43+
// semver library will return an empty string.
44+
if semver.Build(version) == "" {
45+
version += revision
46+
}
4347
})
4448
return version
4549
}

0 commit comments

Comments
 (0)