我对 interface{} 类型感到困惑,
如何从 Person 结构构建 interface{} 对象?
如果结构很大,转换成本是否昂贵
type Person struct {
name string
age int
}
func test(any interface{}) {
}
func main() {
p := Person{"test", 11}
// how to build an interface{} object from person struct?
// what is the cost? the field need copy?
test(p)
}