How to deep copy a map and then clear the original?
You are not copying the map, but the reference to the map. Your delete thus modifies the values in both your original map and the super map. To copy a map, you have to use a for loop like this: for k,v := range originalMap { newMap[k] = v } Here’s an example from the … Read more