Go 1.27 新特性:嵌入式字段终于可以不用俄罗斯套娃了
如果你写过 Go,你一定见过这种“套娃”式的初始化:
type User struct {Name stringAge int
}type Product struct {Title stringPrice float64InStock bool
}type Order struct {OrderID stringUser // 匿名嵌入Product // 匿名嵌入
}以前你想创建…
2026/8/14 5:36:09