I understand that in order to avoid cached results in Go tests you can use the -count=1
flag in the go test
command, but why?
This is from the docs:
The idiomatic way to disable test caching explicitly is to use
-count=1
The explanation for the count
flag is:
-count n
Run each test, benchmark, and fuzz seed n times (default 1).
If -cpu is set, run n times for each GOMAXPROCS value.
Examples are always run once. -count does not apply to
fuzz tests matched by -fuzz.
It doesn't say anything about caching and the default value is 1, but skipping cached tests aren't ignored by default.