1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-17 21:07:54 +02:00

fix gopath compatible with windows

This commit is contained in:
vanex 2019-09-21 00:11:56 +08:00
parent c49c033762
commit 676cbb15a8

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]
}