News for hackers. Stuff that matters.
Re:How We Went from 30 Servers to 2: Go by f2f on Wednesday March 13, 2013 @02:46AM (#5367187)
Here's a more idiomatic go version:

http://play.golang.org/p/oH850AdLuQ

what you don't realize (apart from the fact that go doesn't terminate lines with semicolons since 2009) is that you don't need to create a copy that's typed []interface{} because []X already satisfies interface{} and you can use reflection to handle it. if a seasoned Go programmer wanted to write a somewhat generic map function they'd do something similar to this:

http://play.golang.org/p/qM8sBNcdwY

It doesn't look pretty and you're right, most go programmers don't have to write code like this. It is much more common to define a common interface for something that's map-able and expect callers to implement that. examples in sort.Interface.

Re:How We Went from 30 Servers to 2: Go by gnuvince on Wednesday March 13, 2013 @02:56AM (#5367207)
In your more idiomatic version, you actually went ahead and changed the declaration of words to be []interface{}, but you may not be in control of the type of words (for instance if it's the return value of a function). This is why I did the explicit conversion. As for the reflection, it's pretty ugly.

Also, what about semi-colons?

Re:How We Went from 30 Servers to 2: Go by f2f on Wednesday March 13, 2013 @03:05AM (#5367227)
i understand why you did the explicit conversion, the idea i was trying to relay is why i undid it...

nevermind the semicolons, 'twas a joke :)