go get 无法下载golang官方工具包方案

出错信息:无法连接https://golang.org

go get github.com/zserge/lorca
unrecognized import path "golang.org/x/net/websocket": https fetch: Get "https://golang.org/x/net/websocket?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:在GOPATH目录下建立对应包名,然后通过git下载工具包

mkdir -p %GOPATH%\src\golang.org\x
cd %GOPATH%\src\golang.org\x
git clone https://github.com/golang/net.git

C:\GOPATH\src\golang.org\x>git clone https://github.com/golang/net.git
Cloning into 'net'...
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 9286 (delta 18), reused 22 (delta 6), pack-reused 9233 eceiving objects:  99% (9273/9286), 7.90 MiB | 40.0Receiving objects: 100% (9286/9286), 7.93 MiB | 40.00 KiB/s
51.00 KiB/s, done.
Resolving deltas: 100% (6423/6423), done.

方法2:设置Module国内代理仓库

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值