Open xichencx opened 1 year ago
I don't believe this is a bug. The private field I expect should not be copied, and an error should be returned. What are your expectations regarding this?
I don't believe this is a bug. The private field I expect should not be copied, and an error should be returned. What are your expectations regarding this?
如果按照上述说法,那我这种方式去进行copy的时候会成功
`func TestName(t testing.T) { t.Run("validate error flag name", func(t testing.T) { type SrcTags struct { Field1 string field2 string }
type DestTags struct {
Field1 string `copier:"Field1"`
Field2 string `copier:"Field2"`
}
dst := &DestTags{}
src := &SrcTags{
Field1: "Field1->Field1",
field2: "Field2->Field2",
}
err := copier.Copy(dst, src)
t.Log(dst)
if err == nil {
t.Fatal("must validate error")
}
})
}`
@xichencx here I tried your codebase. it'll raise an error, is it in your expectation? here
Reproducible Example
func TestName(t testing.T) { t.Run("validate error flag name", func(t testing.T) { type SrcTags struct { field1 string Field2 string }
}
Description
src structure中存在私有变量,dst structure中使用copier标签进行拷贝会导致src structure中其他变量拷贝失败