News for hackers. Stuff that matters.
Re:Go 1.8 Release Notes by justinsaccount on Thursday February 16, 2017 @07:33PM (#13664947)
ah, SliceStable does make it a little easier at least. I'd say you could just wrap that in a function, but you can't easily do that.

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

  hosts.sort(key=operator.attrgetter("os", "version", "address"))
and then proceed to write the 20 lines of code that lets me do that :-(
Re:Go 1.8 Release Notes by grey-area on Thursday February 16, 2017 @07:50PM (#13665020)
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).
Re:Go 1.8 Release Notes by SaidinWoT on Thursday February 16, 2017 @10:17PM (#13665661)
Perhaps something combining all of the things you've made use of? https://play.golang.org/p/8RDqjjZDB8