go mod包管理 加代理下载

原始go.mod文件

module xxx

go 1.14

报错 i/o timeout

go mod init workorder
go mod init: go.mod already exists

go mod tidy
go: finding module for package github.com/greyh4t/zhttp
go: finding module for package github.com/tidwall/gjson
go: finding module for package github.com/deckarep/golang-set
workorder imports
        github.com/deckarep/golang-set: module github.com/deckarep/golang-set: Get "https://proxy.golang.org/github.com/deckarep/golang-set/@v/list": dial tcp 34.64.4.81:443: i/o timeout
workorder imports
        github.com/greyh4t/zhttp: module github.com/greyh4t/zhttp: Get "https://proxy.golang.org/github.com/greyh4t/zhttp/@v/list": dial tcp 34.64.4.81:443: i/o timeout
workorder imports
        github.com/tidwall/gjson: module github.com/tidwall/gjson: Get "https://proxy.golang.org/github.com/tidwall/gjson/@v/list": dial tcp 34.64.4.81:443: i/o timeout

加代理

➜  ~ vim ./.zshrc

export GO111MODULE=on
export GOPROXY=https://goproxy.io

➜  ~ . ./.zshrc

然后在运行一次:go mod tidy

加载后的go.mod文件

module xxx

go 1.14

require (
	github.com/deckarep/golang-set v1.7.1
	github.com/greyh4t/zhttp v0.0.0-20200602035456-2186ce915b30
	github.com/stretchr/testify v1.6.1 // indirect
	github.com/tidwall/gjson v1.6.0
)

参考

https://blog.csdn.net/dgatiger/article/details/105205190
https://blog.csdn.net/zzhongcy/article/details/97243826

posted @ 2020-06-11 18:04  Mysticbinary  阅读(130)  评论(0编辑  收藏