Context
Pre-download the Go toolchains used by internal/test/compilecheck so the compile check does not download them at runtime.
- compile_check_test.go:161-182 runs every go:<ver> subtest and every arch: sub-subtest with t.Parallel(). The very first invocation for each version (go version with GOTOOLCHAIN=go1.25.0) triggers an on-demand toolchain fetch (~80 MB from the module proxy) inside the container, and the sibling parallel execs for the same version block on the module-cache lock while it happens. Pre-downloading turns that into an image-build cost paid once.
- CI flake surface: a proxy hiccup during the run currently fails a compile check that has nothing to do with compilation. In the image build it's at least retried/cached by the Docker layer.
- Same container is reused for all subtests, so a RUN GOTOOLCHAIN=go1.25.0 go version in the Dockerfile is all it takes. The downloaded toolchain lands in GOMODCACHE/golang.org/toolchain@... and is found by every later exec.
Definition of done
Update Dockerfile to pre-download the Go toolchains.
Roughly:
RUN for v in 1.25.0 1.26.0; do GOTOOLCHAIN=go$v go version; done
Pitfalls
It duplicates the version list. goVersions in compile_check_test.go:43-46 would drift from the Dockerfile silently. Either pass the list in as a build arg from the test's FromDockerfile (there's already a BuildArgs field on the request), or add a comment on goVersions pointing at the Dockerfile line. I would do the build arg since it is a couple of lines and keeps a single source of truth.