在使用go mod 初始化项目时,可以使用以下命令设置GOPROXY

go env -w GOPROXY='https://goproxy.cn,direct'

这将设置GOPROXYhttps://goproxy.cn,同时使用direct指示直接访问原始模块源。

GOPROXY是一个环境变量,用于指定模块代理的地址。常见的模块代理有https://goproxy.cnhttps://proxy.golang.org等。可以根据自己的需求选择适合的模块代理。


原文地址: https://www.cveoy.top/t/topic/pBRP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录