A walkthrough of how DoltHub set up Go test coverage collection across both unit tests and integration tests (including BATS CLI tests) for the Dolt database. Covers using `go test -cover`, building coverage-instrumented binaries with `go build -cover`, merging coverage data with `go tool covdata`, and generating HTML reports with `go tool cover`. Also discusses using Claude to build a better HTML report viewer and integrating coverage uploads into GitHub Actions. The team found 49% average coverage across 1,910 files, but ultimately decided not to automate coverage reporting due to large codebase size, Go error-handling noise, and confidence in existing correctness suites.
Table of contents
Getting test coverage for unit tests #Finding a set of packages to instrument for coverage data #Getting coverage data for integration tests #Generating a coverage report #The coverage.html file #Putting it all together in continuous integration #Results and discussion #Conclusion #2 Impressions