【Golang记录】go项目中如何导入github包,导入包红色问题解决

  • Post author:
  • Post category:golang




问题描述:


Golang项目中,导入包异常。

解决方案:


1.先打开导包的地址链接,确保地址正常,如果出现404了,那地址肯定错了,重新排查吧。


2.在命令行输入 go get 包的地址,如下图


如果加载缓慢,或者报错

go get github.com/kubeedge/kubeedge/tree/mappers/common: module github.com/kubeedge/kubeedge/tree/mappers/common: Get "https://proxy.golang.org/github.com/kubeedge/kubeedge/tree/mappers/common/@v/list": dia
l tcp 172.217.160.81: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 fail
ed to respond.

可以设置go的代理。

GOPROXY=https://goproxy.io

支持开源,拥抱开源,为开发者赋能。