Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
sort: use By as a type name in struct definition #6708
In the planet sorter example, on line 38, the By type is defined but not used: http://tip.golang.org/src/pkg/sort/example_keys_test.go#L38 Replace: by func(p1, p2 *Planet) bool // Closure used in the Less method. with: by By // Closure used in the Less method.
Apart from less keystrokes, I agree, there is no very compelling reason to do so :-) It was pleasant to see an example of function literals and type conversions in this bit of code; it is a slightly under documented aspect of Go, apart from: http://golang.org/doc/codewalk/functions/ Maybe a blog post on the subject would be good?