mirror of
https://github.com/beego/bee.git
synced 2024-11-21 23:50:54 +00:00
Check Gopath in one place
This commit is contained in:
parent
3daa0d2639
commit
6afbafa250
@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/beego/bee/cmd/commands"
|
"github.com/beego/bee/cmd/commands"
|
||||||
beeLogger "github.com/beego/bee/logger"
|
beeLogger "github.com/beego/bee/logger"
|
||||||
"github.com/beego/bee/logger/colors"
|
"github.com/beego/bee/logger/colors"
|
||||||
|
"github.com/beego/bee/utils"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -117,16 +118,15 @@ func ShowShortVersionBanner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetBeegoVersion() string {
|
func GetBeegoVersion() string {
|
||||||
gopath := os.Getenv("GOPATH")
|
|
||||||
re, err := regexp.Compile(`VERSION = "([0-9.]+)"`)
|
re, err := regexp.Compile(`VERSION = "([0-9.]+)"`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if gopath == "" {
|
wgopath := utils.GetGOPATHs()
|
||||||
|
if len(wgopath) == 0 {
|
||||||
beeLogger.Log.Error("You need to set GOPATH environment variable")
|
beeLogger.Log.Error("You need to set GOPATH environment variable")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
wgopath := path.SplitList(gopath)
|
|
||||||
for _, wg := range wgopath {
|
for _, wg := range wgopath {
|
||||||
wg, _ = path.EvalSymlinks(path.Join(wg, "src", "github.com", "astaxie", "beego"))
|
wg, _ = path.EvalSymlinks(path.Join(wg, "src", "github.com", "astaxie", "beego"))
|
||||||
filename := path.Join(wg, "beego.go")
|
filename := path.Join(wg, "beego.go")
|
||||||
|
Loading…
Reference in New Issue
Block a user