Skip to content

Instantly share code, notes, and snippets.

@xlab
Created September 23, 2014 12:53
Show Gist options
  • Save xlab/55a28197edfb748f0ad9 to your computer and use it in GitHub Desktop.
Save xlab/55a28197edfb748f0ad9 to your computer and use it in GitHub Desktop.
<snippet>
<content><![CDATA[
type ${1:type}s []*${1:type}
func (s ${1:type}s) Len() int { return len(s) }
func (s ${1:type}s) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s ${1:type}s) Less(i, j int) bool { return s[i].${2:field} < s[j].${2:field} }
]]></content>
<tabTrigger>gosort</tabTrigger>
<scope>source.go</scope>
<description>Insert slice sorting routines</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment