I was surprised I could initialize a slice of pointers in this way:
package main
import (
"fmt"
)
type index struct {
i, j int
}
func main() {
indices := []*index{{0, 1}, {1, 3}} // Why does this work?
fmt.Println(*indices[1])
}
I was expecting to have to write something more verbose like:
indices := []*index{&index{0, 1}, &index{1, 3}}
Where would I find this in the documentation?