mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 17:20:24 +08:00
fc59aec2e7
Signed-off-by: cui fliter <imcusg@gmail.com> Signed-off-by: cui fliter <imcusg@gmail.com>
26 lines
639 B
Go
26 lines
639 B
Go
package upgrade
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/zeromicro/go-zero/tools/goctl/rpc/execx"
|
|
)
|
|
|
|
// upgrade gets the latest goctl by
|
|
// go install github.com/zeromicro/go-zero/tools/goctl@latest
|
|
func upgrade(_ *cobra.Command, _ []string) 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
|
|
}
|