Hacker News new | ask | show | jobs
by majewsky 3570 days ago
> Go is extremely pedantic about a number of things like unused library imports, trailing commas, etc. which have absolutely no bearing on the actual compiled code

Trailing commas, agreed. But unused library imports have the (probably unintended) side effect that their `func init()` will execute. Which is also why there is an idiomatic way to import a module without giving it an identifier, just to have this side effect.

1 comments

Good point. And there can actually be more than one init() function per package!
Yes, but I guess that they're just concatenated at compile-time.