使用国内七牛云的 go module 镜像。
参考 https://github.com/goproxy/goproxy.cn。
golang 1.13 可以直接执行:
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
阿里云 Go Module 国内镜像仓库服务
设置方法
go env -w GO111MODULE=on
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
这里我们使用代理镜像,参考goproxy。执行如下命令:
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
之后就可以执行成功了,如下图:
$ go get -u github.com/kataras/iris
go get github.com/kataras/iris: module github.com/kataras/iris: Get "https://goproxy.cn/github.com/kataras/iris/@v/list": dial tcp: i/o timeout
zhaoliang:iris zhaoliang$ go get -u github.com/kataras/iris
go: downloading github.com/kataras/iris v11.1.1+incompatible
go: github.com/kataras/iris upgrade => v11.1.1+incompatible
go: downloading gopkg.in/yaml.v2 v2.2.2
go: finding module for package github.com/flosch/pongo2
go: finding module for package github.com/Joker/jade
go: finding module for package github.com/iris-contrib/formBinder
go: downloading golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
go: downloading github.com/Joker/jade v1.0.0
go: downloading github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4
go: downloading github.com/iris-contrib/formBinder v5.0.0+incompatible
go: found github.com/iris-contrib/formBinder in github.com/iris-contrib/formBinder v5.0.0+incompatible
go: found github.com/Joker/jade in github.com/Joker/jade v1.0.0
go: found github.com/flosch/pongo2 in github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4
go: finding module for package github.com/gorilla/schema
go: downloading github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5
go: downloading github.com/gorilla/schema v1.1.0
go: found github.com/gorilla/schema in github.com/gorilla/schema v1.1.0
go: github.com/modern-go/reflect2 upgrade => v1.0.1
go: github.com/modern-go/concurrent upgrade => v0.0.0-20180306012644-bacd9c7ef1dd
go: golang.org/x/text upgrade => v0.3.2
go: github.com/juju/errors upgrade => v0.0.0-20200330140219-3fe23663418f
go: golang.org/x/net upgrade => v0.0.0-20200501053045-e0ff5e5a1de5
go: golang.org/x/crypto upgrade => v0.0.0-20200429183012-4b2356b1ed79
go: gopkg.in/yaml.v2 upgrade => v2.2.8
go: golang.org/x/sys upgrade => v0.0.0-20200501052902-10377860bb8e
go: downloading golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading github.com/juju/errors v0.0.0-20200330140219-3fe23663418f
go: downloading golang.org/x/sys v0.0.0-20200501052902-10377860bb8e
go: downloading golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5
go: downloading github.com/modern-go/reflect2 v1.0.1
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
----------------------以上写的iris程序仍然无非响应-----------------------
具体解决方案看01
有疑问加站长微信联系(非本文作者)