title: Is there an established pattern name for golang code which seems similar to a mixin
body: <p>The gist <a href="https://gist.github.com/anonymous/68c3b072538ec48c2667f7db276e781b" rel="nofollow noreferrer">https://gist.github.com/anonymous/68c3b072538ec48c2667f7db276e781b</a> is a minimal simplified example of a repeated golang code pattern that I have encountered in an existing code base which I am trying to document.  From its usage it appears to be similar to a mixin, but neither myself or any of my colleagues have actually seen this pattern before in golang. Can anyone tell me an appropriate established name for this pattern?</p>
  
  <p>The gist attempts to illustrate:</p>
  
  <ul>
  <li>Unmodified behaviour implementation code (M's funcs) used by multiple types (A and B).</li>
  <li>Included by composition into a host type (A and B).</li>
  <li>Behaviour methods exported and accessible via a host.behaviour.method(...) call e.g. a.Formatter.FormatText(...).</li>
  <li>Host methods are acted upon by the behaviour.</li>
  <li>The behaviour holds state (private or exported) which modifies the execution of the behaviour.</li>
  <li>The type that has add a specific behaviour added can be used by a function needing that behaviour by passing the behaviour field e.g. b := NewB().Formatter.</li>
  <li>Many different behaviours can be composed into a given type (not actually shown for brevity, but you could imagine an M1, M2, M3, etc being included into A or B).</li>
  </ul>
  
  <p>It does not seem to strictly satisfy much of the definitions for a mixin as it manipulates the host object in ways that were beyond M's knowledge when it was written (potentially modifying host state) and doesn't directly add methods to the host type:</p>
  
  <ul>
  <li><a href="https://en.wikipedia.org/wiki/Mixin" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Mixin</a>   </li>
  <li><a href="https://stackoverflow.com/questions/533631/what-is-a-mixin-and-why-are-they-useful">What is a mixin, and why are they useful?</a>    </li>
  <li><a href="https://stackoverflow.com/questions/925609/mixins-vs-traits/4802854#4802854">Mixins vs. Traits</a></li>
  </ul>
  
  <p>And it doesn't seem to follow the same pattern as some self proclaimed 'golang mixins' I have found:</p>
  
  <ul>
  <li><a href="https://gist.github.com/haazime/270657beb140a307a559" rel="nofollow noreferrer">https://gist.github.com/haazime/270657beb140a307a559</a></li>
  <li><a href="https://gist.github.com/hasanozgan/2598e6abe80803e4573b" rel="nofollow noreferrer">https://gist.github.com/hasanozgan/2598e6abe80803e4573b</a></li>
  <li>Limited mixin-like behaviour by embedding (e.g. embedding sync.Mutex) <a href="https://groups.google.com/forum/#!topic/golang-nuts/lFWYE8UzBCg" rel="nofollow noreferrer">https://groups.google.com/forum/#!topic/golang-nuts/lFWYE8UzBCg</a></li>
  </ul>