From b2366d49996ddfd042ab5b278d63707d38df74c6 Mon Sep 17 00:00:00 2001 From: Karolis Rusenas Date: Sat, 1 Jul 2017 14:24:39 +0100 Subject: [PATCH] regenerating tag --- types/types.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/types/types.go b/types/types.go index 1c8de22c..f8ff1d7c 100644 --- a/types/types.go +++ b/types/types.go @@ -1,6 +1,7 @@ package types import ( + "bytes" "fmt" "time" ) @@ -27,10 +28,25 @@ type Version struct { Patch int64 PreRelease string Metadata string + + Prefix string // v prefix } func (v Version) String() string { - return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch) + var buf bytes.Buffer + if v.Prefix != "" { + fmt.Fprintf(&buf, v.Prefix) + } + + fmt.Fprintf(&buf, "%d.%d.%d", v.Major, v.Minor, v.Patch) + if v.PreRelease != "" { + fmt.Fprintf(&buf, "-%s", v.PreRelease) + } + if v.Metadata != "" { + fmt.Fprintf(&buf, "+%s", v.Metadata) + } + + return buf.String() } // PolicyType - policy type