traefik/vendor/github.com/Azure/go-autorest/autorest/version.go

36 lines
624 B
Go
Raw Normal View History

2017-02-07 21:33:23 +00:00
package autorest
import (
2017-10-31 09:42:03 +00:00
"bytes"
2017-02-07 21:33:23 +00:00
"fmt"
2017-04-07 09:53:39 +00:00
"strings"
"sync"
2017-02-07 21:33:23 +00:00
)
const (
2017-10-31 09:42:03 +00:00
major = 8
minor = 0
patch = 0
2017-04-07 09:53:39 +00:00
tag = ""
2017-02-07 21:33:23 +00:00
)
2017-10-31 09:42:03 +00:00
var once sync.Once
2017-04-07 09:53:39 +00:00
var version string
2017-02-07 21:33:23 +00:00
// Version returns the semantic version (see http://semver.org).
func Version() string {
2017-10-31 09:42:03 +00:00
once.Do(func() {
semver := fmt.Sprintf("%d.%d.%d", major, minor, patch)
verBuilder := bytes.NewBufferString(semver)
if tag != "" && tag != "-" {
updated := strings.TrimPrefix(tag, "-")
_, err := verBuilder.WriteString("-" + updated)
if err == nil {
verBuilder = bytes.NewBufferString(semver)
}
2017-04-07 09:53:39 +00:00
}
2017-10-31 09:42:03 +00:00
version = verBuilder.String()
2017-04-07 09:53:39 +00:00
})
return version
2017-02-07 21:33:23 +00:00
}