Skip to content

Instantly share code, notes, and snippets.

@ateoto
Created February 25, 2015 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateoto/92ababb26813223eab4d to your computer and use it in GitHub Desktop.
Save ateoto/92ababb26813223eab4d to your computer and use it in GitHub Desktop.
type Tag struct {
Major int
Minor int
Name string
}
type Tags []Tag
func (slice Tags) Len() int {
return len(slice)
}
func (slice Tags) Less(i, j int) bool {
return slice[i].Major < slice[j].Major && slice[i].Minor < slice[j].Minor
}
func (slice Tags) Swap(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment