Skip to content

Commit

Permalink
chore: show golang version in the version command (envoyproxy#3750)
Browse files Browse the repository at this point in the history
show golang version

Signed-off-by: Huabing Zhao <[email protected]>
  • Loading branch information
zhaohuabing authored Jul 4, 2024
1 parent 9f8adfb commit 780704c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io"
"runtime"
"runtime/debug"
"strings"

Expand All @@ -22,6 +23,7 @@ type Info struct {
GatewayAPIVersion string `json:"gatewayAPIVersion"`
EnvoyProxyVersion string `json:"envoyProxyVersion"`
GitCommitID string `json:"gitCommitID"`
GolangVersion string `json:"golangVersion"`
}

func Get() Info {
Expand All @@ -30,6 +32,7 @@ func Get() Info {
GatewayAPIVersion: gatewayAPIVersion,
EnvoyProxyVersion: envoyProxyVersion,
GitCommitID: gitCommitID,
GolangVersion: runtime.Version(),
}
}

Expand Down Expand Up @@ -68,6 +71,7 @@ func Print(w io.Writer, format string) error {
_, _ = fmt.Fprintf(w, "ENVOY_PROXY_VERSION: %s\n", v.EnvoyProxyVersion)
_, _ = fmt.Fprintf(w, "GATEWAYAPI_VERSION: %s\n", v.GatewayAPIVersion)
_, _ = fmt.Fprintf(w, "GIT_COMMIT_ID: %s\n", v.GitCommitID)
_, _ = fmt.Fprintf(w, "GOLANG_VERSION: %s\n", v.GolangVersion)
}

return nil
Expand Down

0 comments on commit 780704c

Please sign in to comment.