I found the solution to the "toolchain not available" problem: put "go 1.22.0" instead of "go 1.22" in go.mod. Clues picked up from #62278 <https://github.com/golang/go/issues/62278>.
It's confusing for people who've been using go for a while though, when go.mod used to contain "go X.Y" and it was invalid to put "go X.Y.Z". Now that appears to have swapped around <https://github.com/golang/go/issues/62278#issuecomment-1698829945>. On Thursday 8 February 2024 at 08:30:25 UTC Brian Candler wrote: > Is it a bug or exepected behaviour? > > > If a test fails, I would expect it to terminate with an error (exit code 1 > in this case). > > If I run your reproducer locally (not in Docker) with the modified > TestHelloer, it works fine(*) and gives me an exit code of 0: > > % go test -v ./... -coverprofile=coverage.out -coverpkg=./internal/... > -covermode count > ? example.com/m [no test files] > === RUN TestHelloer > --- PASS: TestHelloer (0.00s) > PASS > > coverage: 100.0% of statements in ./internal/... > ok example.com/m/internal 0.135s coverage: 100.0% of statements in > ./internal/... > % echo $? > 0 > > Therefore, if your problem only occurs when using Docker, then you should > provide a docker-based reproducer (including the Dockerfile) > > (*) However, I had to change the go.mod file to say version 1.21. If it > says 1.22, I get an error. > > Under Linux (go1.21.7): > > $ go test -v ./... -coverprofile=coverage.out -coverpkg=./internal/... > -covermode count > go: downloading go1.22 (linux/amd64) > go: download go1.22 for linux/amd64: toolchain not available > > Under macOS (go1.21.6): > > % go test -v ./... -coverprofile=coverage.out -coverpkg=./internal/... > -covermode count > go: downloading go1.22 (darwin/arm64) > go: download go1.22 for darwin/arm64: toolchain not available > > I don't *think* this is the same problem as you're seeing, since you say > that the coverage file is created, and presumably you would have noticed > the "toolchain not available" error message. In any case, you're using a > base image with go 1.22.0. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9247783b-ea6f-43ed-9ba5-9384dd7e4e08n%40googlegroups.com.