diff --git a/tool/kratos-protoc/protoc.go b/tool/kratos-protoc/protoc.go index accd6c518..57b3bec19 100644 --- a/tool/kratos-protoc/protoc.go +++ b/tool/kratos-protoc/protoc.go @@ -144,14 +144,7 @@ func latestKratos() (string, error) { } func gopath() (gp string) { - var gopaths []string - - switch runtime.GOOS { - case "windows": - gopaths = strings.Split(os.Getenv("GOPATH"), ";") - default: - gopaths = strings.Split(os.Getenv("GOPATH"), ":") - } + gopaths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator)) if len(gopaths) == 1 && gopaths[0] != "" { return gopaths[0] diff --git a/tool/kratos/tool.go b/tool/kratos/tool.go index 3b410d4c9..cc7f0c258 100644 --- a/tool/kratos/tool.go +++ b/tool/kratos/tool.go @@ -186,14 +186,7 @@ func (t Tool) installed() bool { } func gopath() (gp string) { - var gopaths []string - - switch runtime.GOOS { - case "windows": - gopaths = strings.Split(os.Getenv("GOPATH"), ";") - default: - gopaths = strings.Split(os.Getenv("GOPATH"), ":") - } + gopaths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator)) if len(gopaths) == 1 && gopaths[0] != "" { return gopaths[0]