How to extend functions onto imported types in Golang
<p>I have an imported type</p>

<pre><code>type ExternalType struct {
   quantity int
}


type ExternalArray []*ExternalType
</code></pre>

<p>I want to be able to implement the sort interface for ExternalArray for so that I sort it by quantity.</p>

<p>However, I am not sure how I could do that?</p>

<p>A concrete example is this:</p>

<p><a href="https://play.golang.org/p/bEPtJ8NHQK" rel="nofollow">https://play.golang.org/p/bEPtJ8NHQK</a></p>