func ShouldNotAllocate(t *testing.T, f func()) {
	t.Helper()
	if Race {
		t.Skip("skip while running with -race")
		return
	}
	if a := testing.AllocsPerRun(10, f); a > 0 {
		t.Errorf("allocations detected: %f", a)
	}
}
ShouldNotAllocate fails if f allocates.
package testutil
import (
	"testing"
)