there is only for loop in go
//example for benchmarking function named Repeat
func BenchmarkRepeat(b *testing.B) {
for i := 0; i < b.N; i++ {
Repeat("a")
}
}
testing.B gives access to b.N it runs the function Repeat(”a”) , b.N times
bench marking functions should start with the keyword Benchmarkxxx(b *testing.B)
to run the bench marks use go test -bench=”.”