Measuring Go Code Coverage with Bincover
Apr 30, 2020Miki Pokryvailo5 min read
Opens confluent.ioWhat the post covers
Introduces Bincover, an open-source tool for measuring Go binary code coverage.
- Details the technical approach of instrumenting binaries with a fake test that runs the main function, and how Bincover enhances this by handling command-line arguments, panics, and `os.Exit()` calls.
- Explains the implementation details of argument parsing via an args file, coverage profile collection using `-test.coverprofile`, and metadata collection for exit codes and cover modes.
- Provides a practical example of using Bincover with a simple Go application and its test suite.