Dynamic access Go version

This commit is contained in:
astaxie 2014-08-11 08:57:20 +08:00
parent 25fccbdf91
commit 270a52100c
1 changed files with 8 additions and 2 deletions

View File

@ -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 {