4 ms·
Re: Go errors for unused imports > This rules out some workflows where I partially finish the code and check if it compiles. Sounds like a great job for an ID
by orbitur 11y ago
Re: Go errors for unused imports
> This rules out some workflows where I partially finish the code and check if it compiles.
Sounds like a great job for an IDE to automatically add/remove the appropriate imports for standard library stuff.
- fizzbatter 11y agoGoimport (i believe is the tool name, i use it for Vim) does just that. Also, because of the namespacing in Go, it actually works for non-standard library imports as well. It runs along with Gofmt on every save for me. The only time in my experience that it has trouble is when there is a namespace conflict and it has to guess. Generally that's easy to avoid though, and uncommon.
- wukerplank 11y agoAtom and the Go Plus Package do exactly that. Very convenient!