一、go build 报错
D:\redis\RedisEXP-main\cmd>go build -o RedisEXP main.go go: downloading github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 go: downloading github.com/go-redis/redis/v8 v8.11.5 ..\pkg\lua.go:6:2: github.com/axgle/mahonia@v0.0.0-20180208002826-3358181d7394:Get "https://proxy.golang.org/github.com/axgle/mahonia/@v/v0.0.0-20180208002826-3358181d7394.zip": dial tcp 172.217.160.81: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...\pkg\Redis.go:9:2: github.com/go-redis/redis/v8@v8.11.5: Get "https://proxy.go lang.org/github.com/go-edis/redis/v8/@v/v8.11.5.zip": dial tcp 172.217.160.81: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.
解决办法:
报错原因是默认使用的是proxy.golang.org,在国内无法访问,换一个国内能访问的代理地址:https://goproxy.cn
执行命令:
go env -w GO111MODULE=ongo env -w GOPROXY=https://goproxy.cn,direct
执行命令就可以了
标签:github,redis,failed,报错,build,go,com From: https://www.cnblogs.com/sentouceshi/p/16951198.html