4 ms·
> Compiler still needs to parse your code to determine if your import is used or not. Parsing is easy. And it's fast. On top of that the compiler already knows
by dmitriid 6y ago
> Compiler still needs to parse your code to determine if your import is used or not.
Parsing is easy. And it's fast. On top of that the compiler already knows it's unused:
--- start quote ---
Go programs with unused imports do not compile. This is a deliberate feature of the language as importing packages slow down the compiler.
--- end quote ---
So, the compiler has already parsed the file, and determined that the import is unused. And refuses to compile further, because... it needs to import that package anyway? Why?
> Dozen separate tools can be used effectively in your workflow
Haha, no. If you need a dozen different tools, there's no question about effectiveness at all.
- deleted 6y ago[deleted]
- knorker 6y ago> And refuses to compile further, because... it needs to import that package anyway? Why? Because it may have side-effects, and the compiler doesn't know if it's the programmer's intention to import in order to get those side-effects, or if it's a mistake.
- dmitriid 6y agohttps://news.ycombinator.com/item?id=26565422 https://news.ycombinator.com/item?id=26565422