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

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

gopath compatible with windows
This commit is contained in:
Sam 2019-09-23 23:07:32 +08:00 committed by GitHub
commit f58765293f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -144,7 +144,15 @@ func latestKratos() (string, error) {
}
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] != "" {
return gopaths[0]
}

View File

@ -186,7 +186,15 @@ func (t Tool) installed() bool {
}
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] != "" {
return gopaths[0]
}