Source file tour/moretypes/struct-literals.go
1 //go:build OMIT 2 3 package main 4 5 import "fmt" 6 7 type Vertex struct { 8 X, Y int 9 } 10 11 var ( 12 v1 = Vertex{1, 2} // has type Vertex 13 v2 = Vertex{X: 1} // Y:0 is implicit 14 v3 = Vertex{} // X:0 and Y:0 15 p = &Vertex{1, 2} // has type *Vertex 16 ) 17 18 func main() { 19 fmt.Println(v1, p, v2, v3) 20 } 21