title: Golang Method Override
body: <p>I have the following:</p>
  
  <pre><code>type Base struct {
  
  }
  
  func(base *Base) Get() string {
      return "base"
  }
  
  func(base *Base) GetName() string {
      return base.Get()
  }
  </code></pre>
  
  <p>I want to define a new type with a new implementation of Get() so that I can use the new type in place of <code>Base</code> and where GetName() is called it calls the new Get() implementation .  If I were using Java I would inherit Base and override Get().  How should I achieve this in Go? I want to avoid breaking changes if possible, so existing consumers of Base do not need to be changed.</p>
  
  <p>My first stab at this looks like..</p>
  
  <pre><code>type Sub struct {
      Base
  }
  
  func(sub *Sub) Get() string {
      return "Sub"
  }
  </code></pre>
  
  <p>..which doesn't work.  My brain isn't wired for Go yet clearly.</p>