Closed
Description
Currently, benchmarks are only run when passing the -bench
flag to go test
. Usually, CI checks don't run benchmarks because of the extra time required and noise reducing the usefulness of the results. This leads to situations where benchmark code can rot, causing it to become a liability instead of an asset. Instead, go test
without the -bench
flag could also run all of the benchmarks for a single iteration (b.N = 1) and just report PASS or FAIL like a normal test. Then benchmark code would be exercised at least as often as test code, preventing rot.
Some details to work out:
- What about
-run
? I would suggest it additionally filters the benchmarks to run when-bench
is not passed.