Hacker News new | ask | show | jobs
by Orangeair 3259 days ago
That's the kind of thing that should be detected by a linter and stop code submission though, not necessarily stop it from even compiling. What if you just want to comment something out quickly? I don't program in Go, but it seems like it would be annoying to have to repeatedly add and remove the main dependencies while I was iterating on something.
2 comments

This problem is fixed by using the "goimports" tool that will automatically add and remove imports as they're used on save. Pretty much every editor supports it. With goimports and gofmt that formats code, I no longer have to think about formatting and imports at all until I git diff, the whole problem vanishes.
It is absurdly annoying. It's the one thing that put me off golang development, despite all of its nice aspects relating to concurrency.

Having custom functionality in editors to work around this apparently dogmatic design decision in the core language.. is also just absurd.