Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package upgrade
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/rpc/execx"
|
"github.com/tal-tech/go-zero/tools/goctl/rpc/execx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
@@ -10,7 +11,11 @@ import (
|
|||||||
// Upgrade gets the latest goctl by
|
// Upgrade gets the latest goctl by
|
||||||
// go get -u github.com/tal-tech/go-zero/tools/goctl
|
// go get -u github.com/tal-tech/go-zero/tools/goctl
|
||||||
func Upgrade(_ *cli.Context) error {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user