From 270a52100c9d889fe5041ecc12e38078874c1e74 Mon Sep 17 00:00:00 2001 From: astaxie Date: Mon, 11 Aug 2014 08:57:20 +0800 Subject: [PATCH] Dynamic access Go version --- version.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/version.go b/version.go index 01fc406..e3d917c 100644 --- a/version.go +++ b/version.go @@ -4,10 +4,11 @@ import ( "bufio" "fmt" "io" + "log" "os" + "os/exec" path "path/filepath" "regexp" - "runtime" ) var cmdVersion = &Command{ @@ -29,7 +30,12 @@ func init() { func versionCmd(cmd *Command, args []string) { fmt.Println("bee :" + version) fmt.Println("beego :" + getbeegoVersion()) - fmt.Println("Go :" + runtime.Version()) + //fmt.Println("Go :" + runtime.Version()) + goversion, err := exec.Command("go", "version").Output() + if err != nil { + log.Fatal(err) + } + fmt.Println("Go :" + string(goversion)) } func getbeegoVersion() string {