package main import "fmt" // Person2 匿名结构体 type Person2 struct { string int } // Address 嵌套结构体 type Address struct { Province, City string } type User struct { Name string Age int Address } func main() { p1 := Person2{ "132", 18, } fmt.Printf("p1: %#v\n", p1) user := User{ Name: "song", Age: 18, Address: Address{ Province: "anhui", City: "An qing", }, } fmt.Printf("%#v\n", user.City) }