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

find other gopath need compatible with windows

This commit is contained in:
vanex 2019-09-21 00:31:59 +08:00
parent 676cbb15a8
commit 6108084a4a

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