From 46ed5d12c11224a04289714c8c4edf0208bd466a Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 27 Aug 2019 10:36:40 +0800 Subject: [PATCH] fix gopath --- tool/kratos-protoc/protoc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/kratos-protoc/protoc.go b/tool/kratos-protoc/protoc.go index af96ad91b..75e25a737 100644 --- a/tool/kratos-protoc/protoc.go +++ b/tool/kratos-protoc/protoc.go @@ -145,7 +145,7 @@ func latestKratos() (string, error) { func gopath() (gp string) { gopaths := strings.Split(os.Getenv("GOPATH"), ":") - if len(gopaths) == 1 { + if len(gopaths) == 1 && gopaths[0] != "" { return gopaths[0] } pwd, err := os.Getwd() @@ -157,6 +157,9 @@ func gopath() (gp string) { return } for _, gopath := range gopaths { + if gopath == "" { + continue + } absgp, err := filepath.Abs(gopath) if err != nil { return