Windows go get下載包失敗問題解決


報錯情況

下載gin包,報錯如下:

unrecognized import path "golang.org/x/crypto/sha3": https fetch: Get "https://golang.org/x/crypto/sha3?go-get=1": dial tcp 216.239.37.1: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.
unrecognized import path "google.golang.org/protobuf/encoding/prototext": https fetch: Get "https://google.golang.org/protobuf/encoding/prototext?go-get=1": dial tcp 216.239.37.1: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.

如圖:

解決方案

設置代理

cmd下輸入:SET GO111MODULE=on

接着cmd輸入:SET GOPROXY=https://goproxy.cn

這里參考的文章上是:

在代理鏈接外添加了雙引號,但是事實上:

出現了轉義

go get github.com/gin-gonic/gin: parse "\"https://goproxy.cn\"": first path segment in URL cannot contain colon

所以這里我們靈活修改為 SET GOPROXY=https://goproxy.cn

代理設置完成,成功下載

參考鏈接


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM