We upgraded golang for our build docker image to use golang 1.21 but forgot to update our test image that runs go-junit-report so it was still running go 1.20.5.
We used the slices package which is only available in 1.21.
Out CI unit test step then reported:
internal/ourpackage/ourfile.go:7:2: package slices is not in GOROOT (/usr/local/go/src/slices)
note: imported by a module that requires go 1.21
Test resulted with exit code of 0
No tests actually ran but the tool returned exit code 0 which means it reported success, and it took us a few weeks to find that out, so we deployed to production versions that were not unit tested!!!
Tested it today with go install github.com/jstemmer/go-junit-report/v2@latest to verify that this is still a bug in the latest version.
Running go test -coverprofile=coverage.out -v -race ./... 2>&1 | go-junit-report -iocopy -set-exit-code -out junit.xml
We upgraded golang for our build docker image to use golang 1.21 but forgot to update our test image that runs
go-junit-report
so it was still running go 1.20.5. We used theslices
package which is only available in 1.21.Out CI unit test step then reported:
No tests actually ran but the tool returned exit code 0 which means it reported success, and it took us a few weeks to find that out, so we deployed to production versions that were not unit tested!!!
Tested it today with
go install github.com/jstemmer/go-junit-report/v2@latest
to verify that this is still a bug in the latest version.Running
go test -coverprofile=coverage.out -v -race ./... 2>&1 | go-junit-report -iocopy -set-exit-code -out junit.xml