go container build (arm) with CGO timeout with net/http: TLS handshake timeout

743 Views Asked by At

I have a project using go mod and CGO that has a relatively large dependency tree.

Building natively (GOOS=linux, GOARCH=amd64) works fine. 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 getting 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):

go: downloading github.com/go-co-op/gocron v1.9.0
scheduler/scheduler.go:7:2: github.com/go-co-op/[email protected]: 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).

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.

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.

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.

Any ideas?

1

There are 1 best solutions below

1
On

Your ISP may have restrictions on accessing https://goproxy.io address. You must use a proxy

set proxy in terminal like:

export https_proxy=127.0.0.1:1080