From a21511b2cfb810508eacbc10cbcc7590b3903053 Mon Sep 17 00:00:00 2001 From: weisenhuang Date: Thu, 20 Jun 2019 12:12:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96GOBIN=E5=BD=93=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8GOPATH=E4=B8=8B=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/kratos/tool.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tool/kratos/tool.go b/tool/kratos/tool.go index 34129a504..60bed2126 100644 --- a/tool/kratos/tool.go +++ b/tool/kratos/tool.go @@ -174,7 +174,11 @@ func (t Tool) updated() bool { } func (t Tool) toolPath() string { - return filepath.Join(gopath(), "bin", t.Alias) + if gobin := os.Getenv("GOBIN");len(gobin) > 0 { + return filepath.Join(gobin, t.Alias) + }else{ + return filepath.Join(gopath(), "bin", t.Alias) + } } func (t Tool) installed() bool { From 4b760a9269c596d06ca39a508f573ed7dcd07116 Mon Sep 17 00:00:00 2001 From: weisenhuang Date: Fri, 21 Jun 2019 16:27:09 +0800 Subject: [PATCH 2/3] m --- tool/kratos/tool.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tool/kratos/tool.go b/tool/kratos/tool.go index 60bed2126..738ee06a2 100644 --- a/tool/kratos/tool.go +++ b/tool/kratos/tool.go @@ -176,9 +176,8 @@ func (t Tool) updated() bool { func (t Tool) toolPath() string { if gobin := os.Getenv("GOBIN");len(gobin) > 0 { return filepath.Join(gobin, t.Alias) - }else{ - return filepath.Join(gopath(), "bin", t.Alias) } + return filepath.Join(gopath(), "bin", t.Alias) } func (t Tool) installed() bool { From 588e4c0861d329aa08a305f5c80954ecc4bdd110 Mon Sep 17 00:00:00 2001 From: weisenhuang Date: Fri, 21 Jun 2019 20:48:09 +0800 Subject: [PATCH 3/3] format code --- tool/kratos/tool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/kratos/tool.go b/tool/kratos/tool.go index 738ee06a2..45769a265 100644 --- a/tool/kratos/tool.go +++ b/tool/kratos/tool.go @@ -174,7 +174,7 @@ func (t Tool) updated() bool { } func (t Tool) toolPath() string { - if gobin := os.Getenv("GOBIN");len(gobin) > 0 { + if gobin := os.Getenv("GOBIN"); len(gobin) > 0 { return filepath.Join(gobin, t.Alias) } return filepath.Join(gopath(), "bin", t.Alias)