-
Notifications
You must be signed in to change notification settings - Fork 88
/
version.go
31 lines (27 loc) · 877 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
package dataavailability
import (
"fmt"
"io"
"runtime"
)
// Populated during build, don't touch!
var (
Version = "v0.1.0"
GitRev = "undefined"
GitBranch = "undefined"
BuildDate = "Fri, 17 Jun 1988 01:58:00 +0200"
)
// PrintVersion prints version info into the provided io.Writer.
func PrintVersion(w io.Writer) {
fmt.Fprint(w, GetVersionInfo())
}
// GetVersionInfo returns version information as a formatted string.
func GetVersionInfo() string {
versionInfo := fmt.Sprintf("Version: %s\n", Version)
versionInfo += fmt.Sprintf("Git revision: %s\n", GitRev)
versionInfo += fmt.Sprintf("Git branch: %s\n", GitBranch)
versionInfo += fmt.Sprintf("Go version: %s\n", runtime.Version())
versionInfo += fmt.Sprintf("Built: %s\n", BuildDate)
versionInfo += fmt.Sprintf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
return versionInfo
}