在go项目中可能会遇到如下报错:

github.com/spf13/cobra: github.com/spf13/cobra@v1.5.0: Get "https://proxy.golang.org/github.com/spf13/cobra/@v/v1.5.0.zip": dial tcp 142.251.33.113: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.先看下目前的镜像地址:

go env GOPROXY

2.然后换成国内的镜像地址:

阿里云的地址是

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

七牛:https://goproxy.cn

阿里:https://mirrors.aliyun.com/goproxy

官方:https://goproxy.io

Logo

一站式 AI 云服务平台

更多推荐