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