-
Notifications
You must be signed in to change notification settings - Fork 6
解决 go get 太慢的问题 #74
Copy link
Copy link
Closed
Labels
Back-endWhere data really come and goWhere data really come and goSoftwareAbout installation ande usageAbout installation ande usage
Description
需求描述
在国内用 go get 命令下载包,因为众所周知的原因,速度太慢了,有时候甚至直接就下不过来。
解决方案
通过国内镜像网站下载
Are there "always on" module repositories and enterprise proxies?:这里列出了 Go 官方承认的仓库,包括自建的,还有阿里云、七牛云分享出来的。
访问七牛云的开源项目 goproxy.cn,首页上列出来了配置教程,照着配置一下就行。
通过 GitHub 镜像项目下载
go 的一些底层包,会放在 https://go.googlesource.com/ 这个网站上,但有时候开了代理也无法下载,这个时候可以去 https://github.com/golang 上面把对应的包下载过来,然后放到 $GOPATH/src 对应的目录下即可,可能会有提示,说这个包是从 github.com 上下过来的,不用管,不影响代码的编译。
终端开启代理加速下载
有时候即使做了上面的两种设置,下载包的速度也会太慢,甚至直接连不上,那就在终端中输入下面两行命令,开启代理,加速下载。当然了,电脑上首先得有能够顺畅访问外面世界的代理才行。
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Back-endWhere data really come and goWhere data really come and goSoftwareAbout installation ande usageAbout installation ande usage