原因:默认使用的代理是proxy.golang.org,在国内无法访问
[root@localhost test]# go get -u github.com/beego/beego/v2
go get github.com/beego/beego/v2: module github.com/beego/beego/v2: Get "https://proxy.golang.org/github.com/beego/beego/v2/@v/list": dial tcp 172.217.24.17: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.
解决办法:
更换国内代理 代理可选择 goproxy.cn(GoProxy中国)或 mirrors.aliyun.com/goproxy/ (阿里云仓库)
1、windows环境下
$ go env -w GO111MODULE=on
#GoProxy中国
$ go env -w GOPROXY=https://goproxy.cn
#阿里云仓库
$ go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
2、Linux环境下
$ export GO111MODULE=on
#GoProxy中国
$ export GOPROXY=https://goproxy.cn
#阿里云仓库
$ export GOPROXY=https://mirrors.aliyun.com/goproxy/