首页 文章
  • 0 votes
     answers
     views

    深度复制struct在golang中具有指针0值

    我在 golang 中有一个结构如下 type Test struct { prop *int } 当 prop 指向零值时,我想对struct对象进行深度复制 . 真正的结构体中有更多的字段,我想要整个struct obj的深度复制 . 我尝试使用 gob 编码 - 解码方式,但由于设计的结果,它将指针转换为0指向nil指针here . 我也尝试使用 reflect.Copy ,但它发...

热门问题