version data
This commit is contained in:
parent
12b62ccee4
commit
9d85908628
18
version/data.go
Normal file
18
version/data.go
Normal file
@ -0,0 +1,18 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// gitDescribe : Git's "git describe --always --dirty" output
|
||||
var gitDescribe = ""
|
||||
|
||||
// BuildDate : Date of this build in YYYY-MM-DD format
|
||||
var BuildDate = ""
|
||||
|
||||
// GoVersion : The go version used to compile this binary
|
||||
var GoVersion = runtime.Version()
|
||||
|
||||
// OsArch : The OS and archetcture used for this binary
|
||||
var OsArch = fmt.Sprintf("%s (%s)", runtime.GOOS, runtime.GOARCH)
|
||||
20
version/data_test.go
Normal file
20
version/data_test.go
Normal file
@ -0,0 +1,20 @@
|
||||
package version
|
||||
|
||||
import "testing"
|
||||
import "runtime"
|
||||
|
||||
func TestGoVersion(t *testing.T) {
|
||||
got := GoVersion
|
||||
expected := runtime.Version()
|
||||
if got != expected {
|
||||
t.Errorf("Expected: %s ; Got: %s", got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOsArch(t *testing.T) {
|
||||
got := OsArch
|
||||
expected := runtime.GOOS + " (" + runtime.GOARCH + ")"
|
||||
if got != expected {
|
||||
t.Errorf("Expected: %s ; Got: %s", got, expected)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user