patterngoMinor
What Golang function could be used to enforce a minimum code coverage and return an Exit1 if false?
Viewed 0 times
enforcewhatreturnusedexit1andfunctioncouldminimumfalse
Problem
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
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.Solution
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.
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.
Context
StackExchange DevOps Q#4176, answer score: 2
Revisions (0)
No revisions yet.