From c3be6fceedefee148c50713cb1bbe2c6699a2d5b Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Mon, 11 Sep 2023 14:05:47 +0300 Subject: [PATCH] No segments, dont bother with pre/meta Signed-off-by: Kimmo Lehto --- version.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/version.go b/version.go index 6ec2fd9..008dcb6 100644 --- a/version.go +++ b/version.go @@ -36,10 +36,12 @@ func (v *Version) String() string { v.buf = &bytes.Buffer{} segments := v.Segments() - if len(segments) > 0 { - v.buf.WriteRune('v') + if len(segments) == 0 { + return "" } + v.buf.WriteRune('v') + for i, s := range segments { fmt.Fprint(v.buf, strconv.Itoa(s)) if i < len(segments)-1 {