title: Empty interfaces to access struct properties to avoid code duplication
body: <p>I have 2 different API versions, I'm trying to refactor code to avoid duplication.
  In my method I can receive an object from V1 or V2 (which have same properties).
  and I want to access those properties, currently I'm getting the following Error:</p>
  <pre><code>i.name undefined (type interface {} is interface with no methods)
  </code></pre>
  <pre><code>package main
  
  import &quot;fmt&quot;
  
  type V1 struct {
    name string
    age int
    address string
  }
  
  type V2 struct {
    name string
    age int  
  }
  
  
  func main() {
      v1 := &amp;V1{name: &quot;Susan&quot;, age: 15}
      describe(v1)
      
      v2 := &amp;V2{name: &quot;John&quot;, age: 21}
      describe(v2)    
  }
  
  func describe(i interface{}) error {
      fmt.Printf(&quot;(%v, %T)\n&quot;, i, i)
      switch v := i.(type) {
      default:    
             return fmt.Errorf(&quot;Error detected, unexpected type %T&quot;, v)       
      case *V1:
          fmt.Println(&quot;*V1&quot;)
          i = i.(*V1)     
      case *V2:
          fmt.Println(&quot;*V2&quot;)
          i = i.(*V2)
      }
      fmt.Println(i.name)
      return nil
  }
  </code></pre>
  <p>Any suggestions?</p>