Hacker News new | comments | ask | show | jobs | submit login

So I've given Go a try with a couple of projects, and I like it so far. However, I really don't like its "warnings are errors" feature — in particular in respect to unused imports. If I comment out a line that uses an import, then it no longer compiles until I go to the top of the file and comment it out.

Has anyone come up with a good solution to this? Preferably using Vim tooling.

Yep. In vim (make sure to have plugins that come with go in misc/vim/ directory installed):

   :Drop fmt
to remove package "fmt" from imports, and

   :Import fmt
to put it back.

Just use goimports which is removing/adding imports automatically based on your source code: https://github.com/bradfitz/goimports

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact