From 520994fd91e50f2e215eaf775440dbbbca17d139 Mon Sep 17 00:00:00 2001 From: mina Date: Mon, 21 Oct 2019 20:58:16 +0200 Subject: [PATCH] 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 --- utils/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/utils.go b/utils/utils.go index 75b6898..ee8f5e8 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -24,6 +24,7 @@ import ( "path/filepath" "regexp" "runtime" + "strconv" "strings" "text/template" "time" @@ -52,7 +53,10 @@ func IsExist(path string) bool { // GetGOPATHs returns all paths in GOPATH variable. func GetGOPATHs() []string { 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() } return filepath.SplitList(gopath)