Skip to content

benchmark-iteration-mutation

Detect assignments to testing.B.N.

Updated View as Markdown

Default severity: error

The testing package dynamically controls B.N to calibrate benchmark duration and calculate per-operation time. Benchmark code that changes N invalidates those measurements.

Bad

b.N = 1000

Good

for range b.N { operation() }
Navigation

Type to search…

↑↓ navigate↵ selectEsc close