最佳答案
假设我有两个类似的类型:
type type1 []struct {
Field1 string
Field2 int
}
type type2 []struct {
Field1 string
Field2 int
}
是否有一种直接的方法将值从 type1写到 type2,并且知道它们具有相同的字段? (除了编写一个循环将所有字段从源复制到目标)
谢谢。