go包下载失败,go get下载失败解决方案,go get golang.org/x 包失败,go代理,goproxy.io

大家都知道,在go工程里引用了墙外的包,导致无法下载所需要的第三方包。

要解决这个问题就是加代理。

网上各种设置各种换代理的方式我都试过不行,昨天找到一个可行方案,亲测mac,windows都可以正常使用。而且速度还很快哦。

Bash (Linux or macOS)

# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io,direct
# Set environment variable allow bypassing the proxy for specified repos (optional)
export GOPRIVATE=git.mycompany.com,github.com/my/private

PowerShell (Windows)

# Set the GOPROXY environment variable
$env:GOPROXY = "https://goproxy.io,direct"
# Set environment variable allow bypassing the proxy for specified repos (optional)
$env:GOPRIVATE = "git.mycompany.com,github.com/my/private"

官网:GOPROXY.IO

这个不仅好用,设置也简单。只需要执行命令行配置环境变量就好。

 

有问题可以留言,有建议欢迎指出。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值