Yes there are two open source packages regarding "DeepCopy"
https://github.com/mohae/deepcopy/
https://github.com/barkimedes/go-deepcopy/
Has anyone tried them yet?
在2020年4月19日星期日 UTC+8 01:26:11 写道:
> How about doing it manually? You can define a DeepCopy method on the type
> and manually allo
How about doing it manually? You can define a DeepCopy method on the type
and manually allocate a new struct and initialize the maps and slices by
looping over them. That way you get to have more control over all the
fields and problem of private fields is solved as well. I would guess this
would b
The easiest way is to marshal everything into some sort of byte slice, then
unmarshal back. JSON doesn't work for this if there are private fields. But
gotiny (https://github.com/niubaoshu/gotiny) does. If you use interfaces in
your data, you have to register their types, everthing else is autom