It will be a pointer to book
, same as &book{1, "Yellow moon"}
, but the spec allows to elide the type and the &
operator, because it's obvious from the type.
var books = []*book {
{1, "Yellow moon"}, // This is the same as &book{1, "Yellow moon"}
}
Spec: Composite literals:
Within a composite literal of array, slice, or map type T
, elements or map keys that are themselves composite literals may elide the respective literal type if it is identical to the element or key type of T
. Similarly, elements or keys that are addresses of composite literals may elide the &T
when the element or key type is *T
.
[][]Point{{{0, 1}, {1, 2}}} // same as [][]Point{[]Point{Point{0, 1}, Point{1, 2}}}
[2]*Point{{1.5, -3.5}, {}} // same as [2]*Point{&Point{1.5, -3.5}, &Point{}}