Merge pull request #349 from Zenger-sun/krotos/fix-gopath-windows

gopath compatible with windows
pull/354/head
Sam 5 years ago committed by GitHub
commit f58765293f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      tool/kratos-protoc/protoc.go
  2. 10
      tool/kratos/tool.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]
} }

@ -186,7 +186,15 @@ func (t Tool) installed() bool {
} }
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