Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The code is super awkward, I'm pretty sure buggy, and unfortunately illustrates that the author has only a superficial understanding of Go idioms :(


Without actual example of what he does wrong and how it should be done, your post has very little value to a reader like me


e.g.

sync.Once() instead of init()

unhelpful named return parameters

didn't use range over channels


sync.Once() instead of init(). Having the Do closed to where the channels being used makes sure we do not run into deadlock. It's a nice pattern for lazy initializing of channels and goroutine too.


Without more details, this comment is not of much use than "random developer on the internet insults another's code".


Plus "idiomatic code" is overrated.

For example idiomatic Java was a clusterfuck for nearly a decade, with all the EJB's and FactorySingletonProxies and XML everywhere. It would be better for Java programmers to ignore the idiomatic BS prevalent in the community, and just use the language in a saner way.

Idiomatic is often just another name for "how lots of people prefer to do it" or "cargo cult".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: