build command-line-arguments: cannot load github.com/shopspring/decimal: module github.com/shopspring/decimal: Get https://goproxy.io/github.com/shopspring/decimal/@v/list: dial tcp 119.28.201.50: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.
導入第三方包 如 "github.com/shopspring/decimal" 失敗
解決方法 打開cmd,然后輸入:
1、查看 go 版本
go version
2、如果版本為 1.13 及以上
go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.io,direct
低於 1.13 版本
$env:GO111MODULE="on" $env:GOPROXY="https://goproxy.io"
修改了下載的代理地址
分析記錄
然后繼續執行失敗操作 即可成功
go mod download
go run main.go
此時在你的 gopath 路徑下的 pkg/mod 包下存有你剛剛導入的包
go.mod 文件發生改變,並且多出了一個 go.sum