This code (playground link):
package main
import (
"fmt"
"testing"
)
var test = make([]int, 0)
func main() {
fmt.Println(testing.Benchmark(testThis))
}
func testThis(b *testing.B) {
fmt.Println(test)
}
has next output:
[]
[]
[]
[]
[]
[]
2000000000 0.00 ns/op
Program exited.
Why there are six []
inside output?
This code (playground link):
package main
import (
"fmt"
)
var test = make([]int, 0)
func main() {
fmt.Println(test)
}
has single output (and it's clear for me):
[]
Program exited.