Open
Description
It's probably a bit much to add directly in the image build (and might have side effects, like writing logs or temporary files that we don't want), but it would be very reasonable and very prudent for us to add a test of all our images that explicitly runs go test std
to run all the standard library tests (especially for images like #464 / #531 👀).
Metadata
Metadata
Assignees
Labels
No labels
Activity
tianon commentedon Feb 13, 2025
We'll also need to be careful/mindful of Alpine; see golang/go#19938
tianon commentedon Feb 13, 2025
So it'll probably take a lot longer on GHA servers, but that's just a good reason for it to be an image test, not something during build. 👍
tianon commentedon Feb 13, 2025
Oh snap,
docker run -it --rm --init --dns 8.8.8.8 --cap-add NET_ADMIN golang:1.24-alpine sh -c 'apk add --no-cache gcc libc-dev iproute2-minimal && exec "$@"' -- go test std
passes all the tests too. 👀tianon commentedon Feb 13, 2025
Oh, we should include
cmd
too, apparently (go test std cmd
), but even better would be to rungo tool dist test
(with the added complexity thatgo tool dist
isn't built by default): https://cs.opensource.google/go/go/+/refs/tags/go1.24.0:src/cmd/dist/test.go;l=658go run cmd/dist test
seems to do the trick, though 👀tianon commentedon Feb 13, 2025
For some reason,
dist
requiresGOROOT
to be set explicitly, but that's a really easy fix. Here's successful versions of both Linux variants:tianon commentedon Feb 14, 2025
Somewhat ironically, my tests of our Windows images show that our Nano Server images are closer to passing than Server Core, probably because they skip Git-related tests due to a lack of Git in the image, where Server Core tries to run those tests and fails for reasons that are likely related to our usage of "MinGit" instead of "full" Git (but Nano Server also fails in several places because it tries to shell out to
powershell
😂 😭).tianon commentedon Feb 14, 2025
With a bunch of finagling, I got Windows Server Core down to just complaining about
gcc
forcgo
-related tests, but trying to resolve that is a whole new can of worms that lights me back up like it's Christmas in February, so uh, I might need to stop going down this rabbit hole for now.tianon commentedon Feb 14, 2025
It's a hack, but just to document it for the future, this gets really close with Server Core (Nano is going to be harder because of the
powershell
thing, I think):To be clear, I wouldn't do it anything like this (
curl | bash
Invoke-WebRequest | powershell
) for the real deal, but this is what I've been messing with to make progress and figure out what's necessary.