1
0
mirror of https://github.com/beego/bee.git synced 2024-11-21 18:40:54 +00:00

Check Gopath in one place

This commit is contained in:
astaxie 2017-04-24 20:51:56 +08:00
parent 3daa0d2639
commit 6afbafa250

View File

@ -17,6 +17,7 @@ import (
"github.com/beego/bee/cmd/commands"
beeLogger "github.com/beego/bee/logger"
"github.com/beego/bee/logger/colors"
"github.com/beego/bee/utils"
"gopkg.in/yaml.v2"
)
@ -117,16 +118,15 @@ func ShowShortVersionBanner() {
}
func GetBeegoVersion() string {
gopath := os.Getenv("GOPATH")
re, err := regexp.Compile(`VERSION = "([0-9.]+)"`)
if err != nil {
return ""
}
if gopath == "" {
wgopath := utils.GetGOPATHs()
if len(wgopath) == 0 {
beeLogger.Log.Error("You need to set GOPATH environment variable")
return ""
}
wgopath := path.SplitList(gopath)
for _, wg := range wgopath {
wg, _ = path.EvalSymlinks(path.Join(wg, "src", "github.com", "astaxie", "beego"))
filename := path.Join(wg, "beego.go")