Standard Library

GoTesting

Go stdlib package — testing. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

Other Methods

.AllocsPerRun()Neutral
#
Signature
AllocsPerRun(runs int, f func()) float64

AllocsPerRun returns the average number of allocations during calls to f.

.B.Elapsed()Neutral
#
Signature
B.Elapsed() time.Duration

Elapsed returns the measured elapsed time of the benchmark.

.B.ReportAllocs()Neutral
#
Signature
B.ReportAllocs()

ReportAllocs enables malloc statistics for this benchmark.

.B.ReportMetric()Neutral
#
Signature
B.ReportMetric(n float64, unit string)

ReportMetric adds "n unit" to the reported benchmark results.

.B.ResetTimer()Neutral
#
Signature
B.ResetTimer()

ResetTimer zeroes the elapsed benchmark time and memory allocation counters

.B.Run()Neutral
#
Signature
B.Run(name string, f func(b *B)) bool

Run benchmarks f as a subbenchmark with the given name. It reports

.B.RunParallel()Neutral
#
Signature
B.RunParallel(body func(*PB))

RunParallel runs a benchmark in parallel.

.B.SetBytes()Neutral
#
Signature
B.SetBytes(n int64)

SetBytes records the number of bytes processed in a single operation.

.B.SetParallelism()Neutral
#
Signature
B.SetParallelism(p int)

SetParallelism sets the number of goroutines used by RunParallel to p*GOMAXPROCS.

.B.StartTimer()Neutral
#
Signature
B.StartTimer()

StartTimer starts timing a test. This function is called automatically

Fully-Qualified Names

FQNField
testingfqns[0]

Wrong FQN → 0 findings. Verify with: change fqns to garbage → must produce 0 results.

Import

go.mod
// standard library — no go.mod entry required
rule.py
from codepathfinder.go_rule import ...  # testing