网站首页 » Golang » Gin 软件包安装失败

Gin 软件包安装失败

March 16, 2021 Golang

在安装Gin 软件包时失败,报错如下:

go get: module github.com/gin-gonic/gin: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/list": dial tcp 216.58.200.49: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.

实际上是无法访问golang.org导致

使用代理即解决问题, 终端依次输入一下命令:

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

再次执行

$ go get -u github.com/gin-gonic/gin

成功安装Gin软件包


C:\Users\Administrator>go get -u github.com/gin-gonic/gin
go: downloading github.com/gin-gonic/gin v1.6.3
go: downloading github.com/gin-contrib/sse v0.1.0
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/json-iterator/go v1.1.9
go: downloading github.com/golang/protobuf v1.3.3
go: downloading github.com/ugorji/go v1.1.7
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading github.com/go-playground/validator/v10 v10.2.0
go: downloading github.com/ugorji/go/codec v1.1.7
go: downloading golang.org/x/sys v0.0.0-20200116001909-b77594299b42
go: downloading github.com/json-iterator/go v1.1.10
go: downloading github.com/go-playground/validator v9.31.0+incompatible
go: downloading github.com/golang/protobuf v1.4.3
go: downloading github.com/go-playground/validator/v10 v10.4.1
go: downloading github.com/ugorji/go/codec v1.2.4
go: downloading github.com/ugorji/go v1.2.4
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/go-playground/universal-translator v0.17.0
go: downloading github.com/leodido/go-urn v1.2.0
go: downloading github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
go: downloading github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
go: downloading github.com/go-playground/locales v0.13.0
go: downloading github.com/modern-go/reflect2 v1.0.1
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.com/leodido/go-urn v1.2.1
go: downloading golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading google.golang.org/protobuf v1.23.0
go: downloading golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b
go: downloading google.golang.org/protobuf v1.25.0
添加新评论