diff --git a/version/data.go b/version/data.go new file mode 100644 index 0000000..c945276 --- /dev/null +++ b/version/data.go @@ -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) diff --git a/version/data_test.go b/version/data_test.go new file mode 100644 index 0000000..854010f --- /dev/null +++ b/version/data_test.go @@ -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) + } +}