mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
cmd/version: include golang version in output
I've seen this in other tools and I thought it was useful. Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
committed by
Torin Sandall
parent
f2c72c7582
commit
11df2bd9a6
@@ -44,6 +44,7 @@ func generateCmdOutput(out io.Writer, check bool) {
|
||||
fmt.Fprintln(out, "Build Commit: "+version.Vcs)
|
||||
fmt.Fprintln(out, "Build Timestamp: "+version.Timestamp)
|
||||
fmt.Fprintln(out, "Build Hostname: "+version.Hostname)
|
||||
fmt.Fprintln(out, "Go Version: "+version.GoVersion)
|
||||
|
||||
if check {
|
||||
err := checkOPAUpdate(out)
|
||||
|
||||
+3
-1
@@ -79,13 +79,15 @@ func setTestVersion() {
|
||||
version.Vcs = "12345"
|
||||
version.Timestamp = "2020-05-14T06:22:38Z"
|
||||
version.Hostname = "foo"
|
||||
version.GoVersion = "1.14.7"
|
||||
}
|
||||
|
||||
func getTestVersion() string {
|
||||
return "Version: v0.20.0\n" +
|
||||
"Build Commit: 12345\n" +
|
||||
"Build Timestamp: 2020-05-14T06:22:38Z\n" +
|
||||
"Build Hostname: foo\n"
|
||||
"Build Hostname: foo\n" +
|
||||
"Go Version: 1.14.7\n"
|
||||
}
|
||||
|
||||
func getTestServer(update interface{}, statusCode int) (baseURL string, teardownFn func()) {
|
||||
|
||||
@@ -5,9 +5,16 @@
|
||||
// Package version contains version information that is set at build time.
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Version is the canonical version of OPA.
|
||||
var Version = "0.24.0-dev"
|
||||
|
||||
// GoVersion is the version of Go this was built with
|
||||
var GoVersion = runtime.Version()
|
||||
|
||||
// Additional version information that is displayed by the "version" command and used to
|
||||
// identify the version of running instances of OPA.
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user