Golang1.13.x 解決go get 無法下載問題


安裝golang github.com/hyperledger/fabric-contract-api-go依賴包的時候,長時間無響應,最后報如下錯誤:

go: github.com/hyperledger/fabric-contract-api-go@v1.0.0: Get https://proxy.golang.org/github.com/hyperledger/fabric-contract-api-go/@v/v1.0.0.mod: dial tcp 172.217.27.145:443: i/o timeout
~/fabric-samples/test-network
Finished vendoring Go dependencies
++ peer lifecycle chaincode package fabcar.tar.gz --path ../chaincode/fabcar/go/ --lang golang --label fabcar_1
++ res=1
++ set +x
Error: failed to normalize chaincode path: 'go list' failed with: go: github.com/hyperledger/fabric-contract-api-go@v1.0.0: Get https://proxy.golang.org/github.com/hyperledger/fabric-contract-api-go/@v/v1.0.0.mod: dial tcp 172.217.27.145:443: i/o timeout: exit status 1
!!!!!!!!!!!!!!! Chaincode packaging on peer0.org1 has failed !!!!!!!!!!!!!!!!

ERROR !!! Deploying chaincode failed

解決辦法

使用七牛雲 go module 鏡像

golang1.13.x 可以直接執行:

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

然后再次使用 go get 下載 gin 依賴就可以了。


免責聲明!

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



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