搜索
您的当前位置:首页正文

golang国内加速

来源:二三娱乐
问题

众所周知的原因,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
Top