forked from hashicorp/consul-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.go
35 lines (28 loc) · 857 Bytes
/
version.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"bytes"
"fmt"
)
var (
// Name is the name of the binary.
Name string = "consul-template"
// Version is the major version. VersionPrerelease is the prerelease version.
// If VersionPrerelease is empty, this is an official release.
Version string = "0.16.0"
VersionPrerelease string = "rc1"
// GitCommit is the commit. It will be filled in by the compier.
GitCommit string
)
// formattedVersion returns a formatted version string which includes the git
// commit and development information.
func formattedVersion() string {
var versionString bytes.Buffer
fmt.Fprintf(&versionString, "%s v%s", Name, Version)
if VersionPrerelease != "" {
fmt.Fprintf(&versionString, "%s", VersionPrerelease)
if GitCommit != "" {
fmt.Fprintf(&versionString, " (%s)", GitCommit)
}
}
return versionString.String()
}