> Go programs with unused imports do not compile. This is a deliberate feature of the language as importing packages slow down the compiler.
I'm reading this and I can't shake the feeling that this is really bad compiler and/or language design.
Why would the compiler import (that is, parse and compile) a package that's unused in the code?
> A better solution is to use goimports tool. Goimports removes unreferenced imports for you. What’s even better it tries to automatically find and add missing ones.
Why can't the compiler do that? Why do you need a few dozen separate tools to complement the compiler?
I'm reading this and I can't shake the feeling that this is really bad compiler and/or language design.
Why would the compiler import (that is, parse and compile) a package that's unused in the code?
> A better solution is to use goimports tool. Goimports removes unreferenced imports for you. What’s even better it tries to automatically find and add missing ones.
Why can't the compiler do that? Why do you need a few dozen separate tools to complement the compiler?