mirror of
https://github.com/beego/bee.git
synced 2025-07-11 08:01:01 +00:00
fix for issue You need to set GOPATH environment variable even if its exist in shell - issue happened becuase strings.Compare see that go1.13 is less than go1.8 which is wrong in that case
This commit is contained in:
@ -24,6 +24,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
@ -52,7 +53,10 @@ func IsExist(path string) bool {
|
|||||||
// GetGOPATHs returns all paths in GOPATH variable.
|
// GetGOPATHs returns all paths in GOPATH variable.
|
||||||
func GetGOPATHs() []string {
|
func GetGOPATHs() []string {
|
||||||
gopath := os.Getenv("GOPATH")
|
gopath := os.Getenv("GOPATH")
|
||||||
if gopath == "" && strings.Compare(runtime.Version(), "go1.8") >= 0 {
|
v := (strings.Replace(runtime.Version(), ".", "", 1))
|
||||||
|
runtimeVersion, _ := strconv.Atoi(strings.Replace(v, "go", "", 1))
|
||||||
|
oldVersion := 18 //refere to "go1.8"
|
||||||
|
if gopath == "" && runtimeVersion > oldVersion {
|
||||||
gopath = defaultGOPATH()
|
gopath = defaultGOPATH()
|
||||||
}
|
}
|
||||||
return filepath.SplitList(gopath)
|
return filepath.SplitList(gopath)
|
||||||
|
Reference in New Issue
Block a user