Just thought of one more way to do this which is neater - define functions on a simpler slice type:
https://play.golang.org/p/0YcxA-Ufs-
So your sorting becomes quite neat:
sort.SliceStable(changes,changes.byLines)
sort.SliceStable(changes,changes.byUser)
I think I might use it this way (haven't actually used this in a real app yet).Perhaps something combining all of the things you've made use of? https://play.golang.org/p/8RDqjjZDB8
Sorting is probably the one area where I really miss generics in go.. because comparing and sorting IS such a generic thing to do. In my head I think, "Oh, so I just want to do
and then proceed to write the 20 lines of code that lets me do that :-(