title: golang how to access interface fields
body: <p>I have a function as below which decodes some json data and returns it as an interface</p>
  
  <pre><code>package search
  
  func SearchItemsByUser(r *http.Request) interface{} {
  
      type results struct {
          Hits             hits
          NbHits           int
          NbPages          int
          HitsPerPage      int
          ProcessingTimeMS int
          Query            string
          Params           string
      }
  
      var Result results
  
      er := json.Unmarshal(body, &amp;Result)
      if er != nil {
          fmt.Println("error:", er)
      }
      return Result
  
  }
  </code></pre>
  
  <p>I'm trying to access the data fields ( e.g. Params) but for some reasons it says that the interface  has no such field. Any idea why ?</p>
  
  <pre><code>func test(w http.ResponseWriter, r *http.Request) {
  
      result := search.SearchItemsByUser(r)
          fmt.Fprintf(w, "%s", result.Params)
  </code></pre>