-
Notifications
You must be signed in to change notification settings - Fork 86
/
version.go
35 lines (30 loc) · 897 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 worker
import (
"fmt"
"os"
"path/filepath"
"runtime"
"gopkg.in/urfave/cli.v1"
)
var (
// VersionString is the git describe version set at build time
VersionString = "?"
// RevisionString is the git revision set at build time
RevisionString = "?"
// RevisionURLString is the full URL to the revision set at build time
RevisionURLString = "?"
// GeneratedString is the build date set at build time
GeneratedString = "?"
// CopyrightString is the copyright set at build time
CopyrightString = "?"
)
func init() {
cli.VersionPrinter = customVersionPrinter
_ = os.Setenv("VERSION", VersionString)
_ = os.Setenv("REVISION", RevisionString)
_ = os.Setenv("GENERATED", GeneratedString)
}
func customVersionPrinter(c *cli.Context) {
fmt.Printf("%v v=%v rev=%v d=%v go=%v\n", filepath.Base(c.App.Name),
VersionString, RevisionString, GeneratedString, runtime.Version())
}