golang国内加速

作者: 小马别过河 | 来源:发表于2019-11-10 15:57 被阅读0次
问题

众所周知的原因,go获取包的时候,经常会很慢,使得go的学习成本变高,现在推荐个方法,一步解决这个问题。那就是,goproxy的代理,用完你会发现肉眼可见的变快。

方法
  1. 如果你是windows用户,在命令行执行以下命令
$env:GO111MODULE="on"
$env:GOPROXY="https://goproxy.io"

2.如果你是macOS用户或者linux用户,在/etc/profile文件最后,加入以下代码

# Enable the go modules feature
$env:GO111MODULE="on"
# Set the GOPROXY environment variable
$env:GOPROXY="https://goproxy.io"
# 这里废话一句,如果你要当前bash生效,记得执行
source /etc/profile

相关文章

网友评论

    本文标题:golang国内加速

    本文链接:https://www.haomeiwen.com/subject/irdabctx.html