It seems that the build fails when go-getting
golang.org/x/text, due to a GnuTLS error.
go get golang.org/x/text work fine outside any container? (That is, when invoked from a plain shell, inside a directory with a go.mod file)
If so, the issue seems specific to the Docker context (but without more context, it is not possible to tell the reason).