forked from chappjc/dcrspy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.go
More file actions
35 lines (29 loc) · 731 Bytes
/
version.go
File metadata and controls
35 lines (29 loc) · 731 Bytes
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 "fmt"
type version struct {
Major, Minor, Patch int
Label string
Nick string
}
var ver = version{
Major: 1,
Minor: 1,
Patch: 0,
Label: "beta",
Nick: "Paul Manafort"}
// CommitHash may be set on the build command line:
// go build -ldflags "-X main.CommitHash=`git rev-parse --short HEAD`"
var CommitHash string
const appName string = "dcrspy"
func (v *version) String() string {
var hashStr string
if CommitHash != "" {
hashStr = "+" + CommitHash
}
if v.Label != "" {
return fmt.Sprintf("%d.%d.%d-%s%s \"%s\"",
v.Major, v.Minor, v.Patch, v.Label, hashStr, v.Nick)
}
return fmt.Sprintf("%d.%d.%d%s \"%s\"",
v.Major, v.Minor, v.Patch, hashStr, v.Nick)
}