-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathversion.go
34 lines (29 loc) · 862 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
package backend
import (
"fmt"
"runtime"
)
var (
// !! These variables defined by the Makefile and passed in with ldflags !!
// !! DO NOT CHANGE THESE DEFAULT VALUES !!
// Version of application
Version = "devel"
// CommitSHA is the short SHA hash of the git commit
CommitSHA = "unknown"
// BuildDate is the date this application was compiled
BuildDate = "unknown"
)
// PrintVersion prints the current version information to stdout
func PrintVersion() {
fmt.Printf(`aws-power-toggle:
version : %s
build date : %s
git hash : %s
go version : %s
go compiler : %s
platform : %s/%s
`, Version, BuildDate, CommitSHA, runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH)
}
func getVersionResponse() string {
return fmt.Sprintf(`{"version":"%s","git_hash":"%s","build_date":"%s"}`, Version, CommitSHA, BuildDate)
}