1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-02-13 13:48:51 +02:00

Merge pull request #362 from mspromyhaha/master

improve get gopaths
This commit is contained in:
Tony 2019-09-29 09:52:31 +08:00 committed by GitHub
commit 3ff6f39a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 16 deletions

View File

@ -144,14 +144,7 @@ func latestKratos() (string, error) {
}
func gopath() (gp string) {
var gopaths []string
switch runtime.GOOS {
case "windows":
gopaths = strings.Split(os.Getenv("GOPATH"), ";")
default:
gopaths = strings.Split(os.Getenv("GOPATH"), ":")
}
gopaths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator))
if len(gopaths) == 1 && gopaths[0] != "" {
return gopaths[0]

View File

@ -186,14 +186,7 @@ func (t Tool) installed() bool {
}
func gopath() (gp string) {
var gopaths []string
switch runtime.GOOS {
case "windows":
gopaths = strings.Split(os.Getenv("GOPATH"), ";")
default:
gopaths = strings.Split(os.Getenv("GOPATH"), ":")
}
gopaths := strings.Split(os.Getenv("GOPATH"), string(filepath.ListSeparator))
if len(gopaths) == 1 && gopaths[0] != "" {
return gopaths[0]