chore: not using goproxy by default (#4613)

This commit is contained in:
Kevin Wan
2025-01-29 12:28:47 +08:00
committed by GitHub
parent 9213b8ac27
commit f669d84ce8
12 changed files with 39 additions and 98 deletions

View File

@@ -5,19 +5,16 @@ import (
"os/exec"
"runtime"
"github.com/zeromicro/go-zero/tools/goctl/util/env"
"github.com/zeromicro/go-zero/tools/goctl/vars"
)
const goproxy = "GOPROXY=https://goproxy.cn,direct"
func goStart(dir string) {
execCommand(dir, "go run .", prepareGoProxyEnv()...)
execCommand(dir, "go run .")
}
func goModTidy(dir string) int {
log.Debug(">> go mod tidy")
return execCommand(dir, "go mod tidy", prepareGoProxyEnv()...)
return execCommand(dir, "go mod tidy")
}
func execCommand(dir, arg string, envArgs ...string) int {
@@ -34,11 +31,3 @@ func execCommand(dir, arg string, envArgs ...string) int {
_ = cmd.Run()
return cmd.ProcessState.ExitCode()
}
func prepareGoProxyEnv(envArgs ...string) []string {
if env.InChina() {
return append(envArgs, goproxy)
}
return envArgs
}