教程集 www.jiaochengji.com
教程集 >  Golang编程  >  golang教程  >  正文 go 包管理 踩坑

go 包管理 踩坑

发布时间:2023-02-10   编辑:jiaochengji.com
教程集为您提供go 包管理 踩坑等资源,欢迎您收藏本站,我们将为您提供最新的go 包管理 踩坑资源

安装或者 运行 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 包管理 踩坑”的文章就介绍到这了,更多文章或继续浏览下面的相关文章,希望大家以后多多支持JQ教程网!

您可能感兴趣的文章:
golang 踩坑
Golang中defer关键字实现原理
golang 利用github自定义module 踩坑系列 类似于「springboot starter 一毛一样」
go golang 笔试题 面试题 笔试 面试
php架构师都要会什么
Go Modules与GOPROXY 配置
Golang垃圾回收机制
php和django做网站哪个好
go语言坑之for range
Golang包管理工具govendor的使用

[关闭]
~ ~