go-zero/tools/goctl/pkg/golang/install.go
2022-02-21 10:19:33 +08:00

18 lines
311 B
Go

package golang
import (
"os"
"os/exec"
)
func Install(git string) error {
cmd := exec.Command("go", "install", git)
env := os.Environ()
env = append(env, "GO111MODULE=on", "GOPROXY=https://goproxy.cn,direct")
cmd.Env = env
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
return err
}