TL;DR a shallow copy is easy, but it's almost never what you want. https://play.golang.org/p/wpWN3Znop8
Needing to copy an arbitrary value is usually an anti pattern as values can contain references to other values, which contain references to other values, which contain references to other values, sometimes leading back to the previous values. On Tuesday, 2 August 2016 17:13:21 UTC+10, Rayland wrote: > > Let's say I have an object A of some type. Is there a way to create a new > object B with the same type as A without knowing the type of A in advance? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.