regenerating tag

pull/13/head
Karolis Rusenas 2017-07-01 14:24:39 +01:00
parent a9cfe6c294
commit b2366d4999
1 changed files with 17 additions and 1 deletions

View File

@ -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