Hello List, i am searching for a convenient way to deep-clone a nested datastructure.
My data structure looks like this: (map[string]map[string]*processing.AccountingSet) (len=1) { (string) (len=16) "foo1.bar.com:443": (map[string]*processing.AccountingSet) (len=1) { (string) (len=3) "all": (*processing.AccountingSet)(0xc000090060)({ count: (int64) 90, sum: (int64) 80000001480, codes: (map[int]int) (len=1) { (int) 301: (int) 90 }, classes: (map[int]int) (len=6) { (int) 0: (int) 90, (int) 500000: (int) 0, (int) 5000000: (int) 0, (int) 10000000: (int) 0, (int) 60000000: (int) 0, (int) 300000000: (int) 0 } }) } } How can i make a exact, deep, and completely independent copy of that structure? What i tried: (c.stats contains the mentioned data structure which should by copied to c.stats) import "github.com/ulule/deepcopier" c.lastStats = map[string]map[string]*AccountingSet{} err = deepcopier.Copy(c.stats).To(c.lastStats) if err != nil { glog.Errorf("unable to clone : '%s'", err.Error()) } This doesn't work. The target structure is empty after the copy operation. Regards Marc -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/c860e575-28a0-1642-b097-28f592a83e43%40256bit.org.