go module 安裝不了golang.org時的處理方式記錄

go: golang.org/x/[email protected]: unrecognized import path "golang.orgnrecognized import path "golang.org/x/sys" (https fetch: G1: dial tcp 216.239.37.1:443: conneet https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.rty did not properly respond after1:443: connectex: A connection attempt failed because the  connected host has failed to respoconnected party did not properly respond after a period of time, or established connection failed because connected : unrecognized import path "golang.host has failed to respond.)
...
go: golang.org/x/[email protected] party did not properly respo: unrecognized import path "golang.org/x/crypto" (https fed because connected host has failedtch: Get https://golang.org/x/crypto?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.)
go: error loading module requirements

如上,不能安裝sys和crypto這兩個庫,用如下方式即可

1手動加入被牆的包(原始包),一定要記住版本號,實在不知道的話,就試試v0.0.0;

$ go mod edit -require=golang.org/x/[email protected]

2 用github上的鏡像地址替換

$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/crypto@latest

$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/sys@latest
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章