title: gob: type not registered for interface: map[string]interface {}
body: <p><code>gob</code> fails to encode <code>map[string]interface{}</code></p>
  
  <pre><code>gob: type not registered for interface: map[string]interface {}
  </code></pre>
  
  <p><a href="http://play.golang.org/p/Si4hd8I0JE">http://play.golang.org/p/Si4hd8I0JE</a></p>
  
  <pre><code>package main
  
  import (
      "bytes"
      "encoding/gob"
      "encoding/json"
      "fmt"
      "log"
  )
  
  func CloneObject(a, b interface{}) []byte {
      buff := new(bytes.Buffer)
      enc := gob.NewEncoder(buff)
      dec := gob.NewDecoder(buff)
      err := enc.Encode(a)
      if err != nil {
          log.Panic("e1: ", err)
      }
      b1 := buff.Bytes()
      err = dec.Decode(b)
      if err != nil {
          log.Panic("e2: ", err)
      }
      return b1
  }
  
  func main() {
      var a interface{}
      a = map[string]interface{}{"X": 1}
      b2, err := json.Marshal(&amp;a)
      fmt.Println(string(b2), err)
  
      var b interface{}
      b1 := CloneObject(&amp;a, &amp;b)
      fmt.Println(string(b1))
  }
  </code></pre>
  
  <p>Is it possible to encode <code>map[string]interface{}</code> in gob?
  I am able to encode it with JSON</p>