go 包管理 踩坑

栏目: Go · 发布时间: 6年前

内容简介:安装或者 运行 go build 时候报错:说明你需要proxy了(其实用了proxy有时候也没用),或者是用 module 的 replace 来转一下,这个方法有以下缺点:1.有些包还是转发失败

安装或者 运行 go build 时候报错:

go: finding github.com/modern-go/concurrent latest
go: finding gopkg.in/check.v1 latest
go: golang.org/x/net@v0.0.0-20190503192946-f4e77d36d62c: 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.)

说明你需要proxy了(其实用了proxy有时候也没用),或者是用 module 的 replace 来转一下,这个方法有以下缺点:

1.有些包还是转发失败

2.需要一个个的设置很麻烦

找了许久,另外一种办法设置global go proxy 具体方法如下:

1.先清除 cache ,到特定目录删除文件

2.window下 打开 power shell 然后执行如下命令:

$env:GOPROXY = "https://goproxy.io"

不过这个设置只对当年窗口有效!

3.mac 下在~/.bash_profile 文件下(没有就新建)写入:

export GOPROXY=https://goproxy.io

找到一个一劳永逸的 jetbrain 系列的懒人做法:

go 包管理 踩坑

好了,终于可以开始码字了,而不是无脑配环境~.~


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Web Design Handbook

Web Design Handbook

Baeck, Philippe de 编 / 2009-12 / $ 22.54

This non-technical book brings together contemporary web design's latest and most original creative examples in the areas of services, media, blogs, contacts, links and jobs. It also traces the latest......一起来看看 《Web Design Handbook》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具