问题
enic-demo % go get github.com/gin-gonic/gin
go: module github.com/gin-gonic/gin: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/list": dial tcp 142.251.43.17:443: i/o timeout
解决
执行如下两行
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
查看是否执行成功
go env
测试
测试成功
enic-demo % go get github.com/gin-gonic/gin
go: downloading github.com/json-iterator/go v1.1.9
go: downloading github.com/golang/protobuf v1.3.3
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading golang.org/x/sys v0.0.0-20200116001909-b77594299b42
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
go: downloading github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
go: added github.com/gin-contrib/sse v0.1.0
go: added github.com/gin-gonic/gin v1.7.7
go: added github.com/go-playground/locales v0.13.0
go: added github.com/go-playground/universal-translator v0.17.0
go: added github.com/go-playground/validator/v10 v10.4.1
go: added github.com/golang/protobuf v1.3.3
go: added github.com/json-iterator/go v1.1.9
go: added github.com/leodido/go-urn v1.2.0
go: added github.com/mattn/go-isatty v0.0.12
go: added github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
go: added github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
go: added github.com/ugorji/go/codec v1.1.7
go: added golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: added golang.org/x/sys v0.0.0-20200116001909-b77594299b42
go: added gopkg.in/yaml.v2 v2.2.8