bug:
#0 90.38 go: github.com/bytedance/sonic@v1.10.2: Get "https://proxy.golang.org/github.com/bytedance/sonic/@v/v1.10.2.mod": dial tcp 142.251.42.241:443: i/o timeout
------
Dockerfile:6
--------------------
4 | COPY . .
5 |
6 | >>> RUN go build main.go
7 |
8 | EXPOSE 8080
--------------------
ERROR: failed to solve: process "/bin/sh -c go build main.go" did not complete successfully: exit code: 1
解决办法:需要在dockerfile中增加配置,ENV GOPROXY https://goproxy.cn
在终端运行go env -w GOPROXY=https://goproxy.cn是只能决绝go build;docker build go时此方法无法解决;本地go build或go run时出现i/o timeout bug可以在终端运行:
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct