3 ms·
In Go its pretty difficult to build an application with unused dependencies - the compiler complains
by regecks 12y ago
In Go its pretty difficult to build an application with unused dependencies - the compiler complains
- Rapzid 12y agoSo you end up with a lot of these: _ Which is okay, they act as a todo list of sorts. Search your program for _ when you feel like cleaning up. And you can handle all those errors you've been swallowing while you're at it.
- sagichmal 12y agoYou should never write Go code by swallowing errors first and promising yourself you'll clean it up later. You should be coding the error path first, and backfilling your business logic. The error path directly informs your method definitions and the structure of your code, which resist modification once they're in-place.
- joeshaw 12y agoUse `goimports` as a save hook in your editor. It analyzes your code and inserts/removes import lines as needed. Other than the occasional need to fix up an ambiguous import that it guessed incorrectly, I haven't touched import lines in my code in a year.