title: return self struct clone in golang (without reflect)
body: <p>there are two structs,<br>
  <code>Foo</code> has a <code>Clone()</code> method<br>
  <code>Bar</code> is inherit from <code>Foo</code></p>
  
  <pre><code>package main
  
  import "fmt"
  
  type IF interface {
      Clone() IF
  }
  
  type Foo struct {
      i int
  }
  
  func (this *Foo) Clone() IF {
      c := *this
      return &amp;c
  }
  
  type Bar struct {
      Foo
  }
  
  func main() {
      t := &amp;Bar{}
      c := t.Clone()
      fmt.Printf(`%T `, t)
      fmt.Printf(`%T `, c)
  }
  </code></pre>
  
  <p><a href="https://play.golang.org/p/pFn348aydW" rel="nofollow noreferrer">https://play.golang.org/p/pFn348aydW</a></p>
  
  <p>output is </p>
  
  <pre><code>*main.Bar *main.Foo
  </code></pre>
  
  <p>but I want clone a <code>Bar</code>, not <code>Foo</code><br>
  I must add <code>Bar.Clone()</code> exactly the same as <code>Foo.Clone()</code></p>
  
  <pre><code>func (this *Bar) Clone() IF {
      c := *this
      return &amp;c
  }
  </code></pre>
  
  <p><a href="https://play.golang.org/p/J6jT_0f1WW" rel="nofollow noreferrer">https://play.golang.org/p/J6jT_0f1WW</a></p>
  
  <p>Now the output is what I want</p>
  
  <pre><code>*main.Bar *main.Bar
  </code></pre>
  
  <p>If I will write lots of struct like <code>Bar</code>, I won't write lots of <code>Clone()</code>, what I can do ?
  It is best not to use reflect</p>