Show go version when executes with --version.

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
pull/2551/head
Chin-Ya Huang 2020-12-04 13:04:55 +08:00 committed by Brad Davidson
parent 87a43c69e1
commit 3f0f2b342e
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package cmds
import ( import (
"fmt" "fmt"
"os" "os"
"runtime"
"github.com/rancher/k3s/pkg/version" "github.com/rancher/k3s/pkg/version"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -33,6 +34,7 @@ func NewApp() *cli.App {
app.Version = fmt.Sprintf("%s (%s)", version.Version, version.GitCommit) app.Version = fmt.Sprintf("%s (%s)", version.Version, version.GitCommit)
cli.VersionPrinter = func(c *cli.Context) { cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s version %s\n", app.Name, app.Version) fmt.Printf("%s version %s\n", app.Name, app.Version)
fmt.Printf("go version %s\n", runtime.Version())
} }
app.Flags = []cli.Flag{ app.Flags = []cli.Flag{
DebugFlag, DebugFlag,