I use goimports
to automatically reformat my code and make it clean and also keep import in order. But sometimes it works in an incomfortable way together with IDE autosave. Like in this scenario:
I want to add new package to my code.
Then I install it with
dep ensure
and refresh my IDE cache.I can comfortably use the package with IDE autocomplete and navigation.
What happens with goimports
and IDE?
- I add new package
- In order to run
dep ensure
I have to save a file -
goimports
finds unused package and removes it from imports. Not good.
Workaround:
A. Add new package manually with dep ensure -add %packagename%
B. Disable goimports
and move to gofmt
- so-so.
C. Do not autoformat code on save - undesirable.
How to setup things more convenient?
P.S. Unsure about tag godeps
but DEP
is definitly wrong here.