1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-10 00:29:01 +02:00

fix gopath

This commit is contained in:
Tony 2019-08-27 10:36:40 +08:00
parent fa91b1f8c2
commit 46ed5d12c1

View File

@ -145,7 +145,7 @@ func latestKratos() (string, error) {
func gopath() (gp string) { func gopath() (gp string) {
gopaths := strings.Split(os.Getenv("GOPATH"), ":") gopaths := strings.Split(os.Getenv("GOPATH"), ":")
if len(gopaths) == 1 { if len(gopaths) == 1 && gopaths[0] != "" {
return gopaths[0] return gopaths[0]
} }
pwd, err := os.Getwd() pwd, err := os.Getwd()
@ -157,6 +157,9 @@ func gopath() (gp string) {
return return
} }
for _, gopath := range gopaths { for _, gopath := range gopaths {
if gopath == "" {
continue
}
absgp, err := filepath.Abs(gopath) absgp, err := filepath.Abs(gopath)
if err != nil { if err != nil {
return return