title: How can I save and retrieve a map into redis using redigo?
body: <p>I have a map like this, which I want to save/retrive from redis using redigo:</p>
  
  <pre><code>animals := map[string]bool{
      "cat": true,
      "dog":   false,
      "fox": true,
  }
  </code></pre>
  
  <p>The length of the map may vary. </p>
  
  <p>I tried these function:</p>
  
  <pre><code>func SetHash(key string, value map[string]bool) error {
      conn := Pool.Get()
      defer conn.Close()
      _, err := conn.Do("HMSET", key, value)
      if err != nil {
          return fmt.Errorf("error setting key %s to %s: %v", key, value, err)
      }
      return err
  }
  
  
  func GetHash(key string) (map[string]bool, error) {
      conn := Pool.Get()
      defer conn.Close()
      val, err := conn.Do("HGETALL", key)
      if err != nil {
          fmt.Errorf("error setting key %s to %s: %v", key, nil, err)
          return nil,  err
      }
      return val, err
  }
  </code></pre>
  
  <p>But can not make <code>GetHash</code> correctly. I've checked the <a href="https://godoc.org/github.com/gomodule/redigo/redis#pkg-examples" rel="nofollow noreferrer">docs</a> examples and it was not helpful. So appreciate your help to have a working example. </p>