You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package upgrade
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"github.com/tal-tech/go-zero/tools/goctl/rpc/execx"
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Upgrade gets the latest goctl by
|
|
|
|
// go install github.com/zeromicro/go-zero/tools/goctl@latest
|
|
|
|
func Upgrade(_ *cli.Context) error {
|
|
|
|
cmd := `GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go install github.com/zeromicro/go-zero/tools/goctl@latest`
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
cmd = `set GOPROXY=https://goproxy.cn,direct && go install github.com/zeromicro/go-zero/tools/goctl@latest`
|
|
|
|
}
|
|
|
|
info, err := execx.Run(cmd, "")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Print(info)
|
|
|
|
return nil
|
|
|
|
}
|