今天学习gin框架时,拉取github的包失败,提示:
PS E:\GoSource\src\gin_demo> go get -u github.com/gin-gonic/gin
go: downloading github.com/gin-gonic/gin v1.7.7
go get: github.com/gin-gonic/gin@v1.7.7: verifying module: github.com/gin-gonic/gin@v1.7.7: Get "https://sum.golang.org/lookup/github.com/gin-gonic/gin@v1.7.7": dia
l tcp 142.251.42.241:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connect
ion failed because connected host has failed to respond.
大致意思就是主机端host未能响应;
只需要关闭:
go env -w GOSUMDB=off
然后再拉取gin的包就ok了
PS E:\GoSource\src\gin_demo> go get -u github.com/gin-gonic/gin
go: downloading github.com/gin-gonic/gin v1.7.7
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/codec v1.1.7
go: downloading github.com/go-playground/validator/v10 v10.4.1
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading github.com/mattn/go-isatty v0.0.14
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading golang.org/x/sys v0.0.0-20200116001909-b77594299b42
go: downloading github.com/json-iterator/go v1.1.12
go: downloading github.com/ugorji/go v1.1.7
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/validator/v10 v10.11.0
go: downloading github.com/go-playground/validator v9.31.0+incompatible
go: downloading github.com/ugorji/go/codec v1.2.7
go: downloading github.com/ugorji/go v1.2.7
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.com/modern-go/reflect2 v1.0.2
go: downloading github.com/leodido/go-urn v1.2.0
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading github.com/go-playground/universal-translator v0.17.0
go: downloading golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
go: downloading github.com/go-playground/universal-translator v0.18.0
go: downloading github.com/leodido/go-urn v1.2.1
go: downloading github.com/go-playground/locales v0.13.0
go: downloading golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122
go: downloading github.com/go-playground/locales v0.14.0
go: downloading google.golang.org/protobuf v1.28.0
go get: added golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
go get: added golang.org/x/text v0.3.7
go get: added google.golang.org/protobuf v1.28.0
go get: added gopkg.in/yaml.v2 v2.4.0
完美解决,希望可以帮助大家