原始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

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

加载后的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

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄