欢迎您的访问
专注架构,Java,数据结构算法,Python技术分享

golang教程(附录一):Golang代理配置,解决google包无法下载的问题

前言

在开发go项目时经常会用到 golang.org/x下的包,但这个通常无法下载,例如:

go get golang.org/x/net: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt
failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
  • 1
  • 2

下载失败了!!
好不容易golang出了个go module可以不再依赖Gopath,现在包又下不了!!有没有说明解决办法呢???
有!!使用代理!

代理网站:

https://athens.azurefd.net

如何使用代理下载

go版本必须在1.11以上

新建项目

在这里插入图片描述
选择Go Modules(vgo) 在Proxy处将代理地址填入即可;

老项目改用代理

  • 选择settings
    在这里插入图片描述
  • 找到Go==》Go Modules(vgo) 再将代理地址填入Proxy
    在这里插入图片描述

检测结果

在这里插入图片描述
ok!!!

作者:iRich_全栈 | 来源:http://39sd.cn/E9F10

赞(2) 打赏
版权归原创作者所有,任何形式转载请联系作者;码农code之路 » golang教程(附录一):Golang代理配置,解决google包无法下载的问题

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏