4

Follow-up to this Q&A.

How to ensure that a certain minimal code coverage is reached in Golang? E.g. if the CI runs, the build should fail if the code coverage is less than X percent.

In Java, one could use Jacoco and define a minimum code coverage. Other language like Python support minimum code coverage as well.

One option is to simply create a bash script that parsers the output of go test -cover, but I would like to know if there is a off the shelf solution.

030
  • 13,383
  • 17
  • 76
  • 178

1 Answers1

2

There aren't any off the shelf solution currently that allows you to specify a variable number of code coverage percentage.

There is the tool Courtney which enforces 100% code coverage. This tool also allows you to comment on blocks of code which do not need to be covered.