mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-24 03:46:37 +02:00
Merge pull request #349 from Zenger-sun/krotos/fix-gopath-windows
gopath compatible with windows
This commit is contained in:
commit
f58765293f
@ -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…
x
Reference in New Issue
Block a user