嵌套的指针复制,貌似是存在问题的
Closed this issue · 0 comments
mfcheer commented
Reproducible Example
import (
"fmt"
"github.com/jinzhu/copier"
)
type CStruct struct {
d int64
}
type DStruct struct {
d int64
}
type A struct {
a int64
d *CStruct
}
type B struct {
a int64
d *DStruct
}
func main() {
m1 := make(map[int64]*A)
m2 := make(map[int64]*B)
m1[1] = &A{
a: 1,
d: &CStruct{
d: 2,
},
}
copier.Copy(&m2, m1)
fmt.Println(*m1[1])
fmt.Println(*m2[1])
}
{1 0xc000022078}
{0 <nil>}