fix gopath compatible with windows

pull/349/head
vanex 5 years ago
parent c49c033762
commit 676cbb15a8
  1. 10
      tool/kratos-protoc/protoc.go

@ -144,7 +144,15 @@ func latestKratos() (string, error) {
} }
func gopath() (gp string) { func gopath() (gp string) {
gopaths := strings.Split(os.Getenv("GOPATH"), ":") var gopaths []string
switch runtime.GOOS {
case "windows":
gopaths = strings.Split(os.Getenv("GOPATH"), ";")
default:
gopaths = strings.Split(os.Getenv("GOPATH"), ":")
}
if len(gopaths) == 1 && gopaths[0] != "" { if len(gopaths) == 1 && gopaths[0] != "" {
return gopaths[0] return gopaths[0]
} }

Loading…
Cancel
Save