go mod download不能 get golang.org/x 包的解决方案

docker build构建镜像过程RUN go mod download超时报错

Step 5/17 : RUN go mod download
—> Running in 8522035b5137

go: github.com/go-openapi/spec@v0.20.3: Get “https://proxy.golang.org/github.com/go-openapi/spec/@v/v0.20.3.mod”: dial tcp 172.217.160.113:443: i/o timeout
The command ‘/bin/sh -c go mod download’ returned a non-zero code: 1

执行代理:

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

解决问题

Comments are closed.