miekg/dns — pull request #74 by majek (2014-01-10 17:02:46+00:00)
Title: msg.Copy() makes a deep-copy of the msg object

There was a copy function that did shallow copies of the msg
object. Export it and make it support proper deep copying.

Context: In our application we have an in-memory cache of DNS answers. Right now before putting an item into the cache we serialize it. That sucks, every time we have a "hit" we spend CPU time on deserializing the item in cache in order to get the cached dns response. With a deep-copy API on msg object we would be able to store unserialized items in our cache and just deep-copy them when we have a hit. This is potentially much faster.