go get golang.org/x/下载失败 | 运行报错exec: “gcc“: executable file not found in %PATH%
如下图我需要golang.org/x/net/websocket这个包
用GoLand下载包失败,报错
Fetching https://golang.org/x/net/websocket?go-get=1
https fetch failed: 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.
package golang.org/x/net/websocket/...: 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.)
国内使用 go get 安装 golang 官方包会失败
解决办法
使用Git下载对应的包
golang 在 github 有镜像库
在Git窗口里依次执行下面的
mkdir -p $GOPATH/src/golang.org/x --比如我是 mkdir -p D:/Go/src/golang.org/x
cd $GOPATH/src/golang.org/x --切换到 cd D:/Go/src/golang.org/x
git clone https://github.com/golang/net.git
下载成功后GoLand自己就加载了
您可能感兴趣的文章:
golang 包管理工具
GO语言 VSCode开发环境搭建 [Mac]
go mod使用
关于golang性能调试及pprof可视化
C# 结合 Golang 开发
Windows10 golang gRPC环境搭建
golang.org/x/net/trace重复错误
GOPROXY:解决 go get golang.org/x 包失败
LogAgent的工作流程
使用pprof进行golang程序内存分析