By default, Go treats unused import as error, forcing you to delete the import. I want to know if there exists some hope to change to this behavior, e.g. reducing it to warning.
I find this problem extremely annoying, preventing me from enjoying coding in Go.
For example, I was testing some code, disabling a segment/function. Some functions from a lib is no longer used (e.g. fmt, errors, whatever), but I will need to re-enable the function after a little testing. Now the program won't compile unless I remove those imports, and a few minutes later I need to re-import the lib.
I was doing this process again and again when developing a GAE program.
var _ = <module>.Function
works fine and it's conspicuous enough to prevent it from being a common practice. – deft_code Oct 24 '13 at 21:10goimports
as a step in your build process. Without either of those it gets old really fast. – Josef Grahn May 10 '17 at 22:08