[英]go container build (arm) with CGO timeout with net/http: TLS handshake timeout
I have a project using go mod
and CGO
that has a relatively large dependency tree.我有一个使用
go mod
和CGO
的项目,它具有相对较大的依赖树。
Building natively ( GOOS=linux
, GOARCH=amd64
) works fine.本地构建(
GOOS=linux
, GOARCH=amd64
)工作正常。 Building in a CI (on my own runner) using my custom build container (several architectures, including arm
) works mostly ok, though I sometimes get "hangs" while go get
ting deps.使用我的自定义构建容器(几个架构,包括
arm
)在 CI 中构建(在我自己的运行器上)大部分都可以,尽管我有时会“挂起”,而go get
ting deps。
Using the same build image to locally build for arm
(I need to use a container because of CGO
and the corresponding arch-dependent C-toolchain) now gives me the following errors (one example of many):使用相同的构建映像为
arm
本地构建(由于CGO
和相应的依赖于架构的 C 工具链,我需要使用容器)现在给我以下错误(其中一个示例):
go: downloading github.com/go-co-op/gocron v1.9.0
scheduler/scheduler.go:7:2: github.com/go-co-op/gocron@v1.9.0: Get "https://goproxy.io/github.com/go-co-op/gocron/@v/v1.9.0.zip": net/http: TLS handshake timeout
However, I can see (with btop
) that just before this error qemu-arm
was very busy (800 CPU%) running go
related build tasks (in fact a go mod tidy
process).但是,我可以看到(使用
btop
)在此错误之前qemu-arm
非常忙(800 CPU%)运行go
相关的构建任务(实际上是go mod tidy
过程)。
My guess is that this is due to no suitable binary for arm
for particular modules being found, so it will just build them on-the-fly.我的猜测是,这是因为没有找到适合
arm
的特定模块的二进制文件,所以它只会即时构建它们。
So I suspect that the time for the respective module builds from source is counted by go get
as a normal "go get from http", which leads to the observed timeout.所以我怀疑从源代码构建的各个模块的时间由
go get
作为正常的“从 http 获取”来计算,这会导致观察到的超时。
Consequently this would mean I could solve the issue if I would be able to increase the timeout value for go get
, but I haven't found any info on that.因此,这意味着如果我能够增加
go get
的超时值,我就可以解决问题,但我还没有找到任何相关信息。
Any ideas?有任何想法吗?
Your ISP may have restrictions on accessing https://goproxy.io address.您的 ISP 可能对访问https://goproxy.io地址有限制。 You must use a proxy
您必须使用代理
set proxy in terminal like:在终端中设置代理,如:
export https_proxy=127.0.0.1:1080
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.