
Ask HN: Why won't Go compile with unused imports? - fhood
I am very curious as to why this particular &quot;feature&quot; was implemented in the language. I find it very annoying and was wondering if there was a logic to its inclusion in the language.
======
detaro
[https://golang.org/doc/faq#unused_variables_and_imports](https://golang.org/doc/faq#unused_variables_and_imports)

Keeping code clean. If you can't compile with unused imports/variables, you
can't forget them.

~~~
fhood
I was hoping for something more fundamental. That feels like sacrificing
function for form

~~~
jameskilton
I don't understand. What's being sacrificed? Of what use is a list of imports
that aren't used?

~~~
fhood
You have never commented out a section of code that was the only place an
import was used for debugging?

~~~
imauld
Sure. I also use Atom with gofmt installed (the Atom gofmt package allows you
to use goimports as a formatter). Comment the line and hit save and the import
goes away. Uncomment and hit save and it comes back. Tools exist to make
dealing with this requirement painless.

