From 07191dc430f43a362f1030e1d1d871e6d8227ab8 Mon Sep 17 00:00:00 2001 From: anqiansong Date: Tue, 7 Dec 2021 22:24:18 +0800 Subject: [PATCH] fix #1305 (#1307) Co-authored-by: anqiansong --- tools/goctl/upgrade/upgrade.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/goctl/upgrade/upgrade.go b/tools/goctl/upgrade/upgrade.go index 94952c40..a78e0958 100644 --- a/tools/goctl/upgrade/upgrade.go +++ b/tools/goctl/upgrade/upgrade.go @@ -2,6 +2,7 @@ package upgrade import ( "fmt" + "runtime" "github.com/tal-tech/go-zero/tools/goctl/rpc/execx" "github.com/urfave/cli" @@ -10,7 +11,11 @@ import ( // Upgrade gets the latest goctl by // go get -u github.com/tal-tech/go-zero/tools/goctl func Upgrade(_ *cli.Context) error { - info, err := execx.Run("GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/tal-tech/go-zero/tools/goctl", "") + var cmd = `GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go install github.com/tal-tech/go-zero/tools/goctl@cli` + if runtime.GOOS == "windows" { + cmd = `set GOPROXY=https://goproxy.cn,direct && go install github.com/tal-tech/go-zero/tools/goctl@cli` + } + info, err := execx.Run(cmd, "") if err != nil { return err }