From 9867c811cd6ea230c9a3146d8512c4ade8bc3d79 Mon Sep 17 00:00:00 2001 From: kylecarbs Date: Mon, 2 May 2022 14:18:16 +0000 Subject: [PATCH] fix: Prefix buildinfo tag with "v" This fixes the format of production and development build tags. --- buildinfo/buildinfo.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/buildinfo/buildinfo.go b/buildinfo/buildinfo.go index bce2e5bb0cfc8..224a248a8fb5f 100644 --- a/buildinfo/buildinfo.go +++ b/buildinfo/buildinfo.go @@ -33,13 +33,17 @@ func Version() string { revision = "+" + revision[:7] } if tag == "" { + // This occurs when the tag hasn't been injected, + // like when using "go run". version = "v0.0.0-devel" + revision return } - if semver.Build(tag) == "" { - tag += revision - } version = "v" + tag + // The tag must be prefixed with "v" otherwise the + // semver library will return an empty string. + if semver.Build(version) == "" { + version += revision + } }) return version }