-
Notifications
You must be signed in to change notification settings - Fork 819
-
In certain circumstances where a Go package can be imported from different fully qualified name like assert
or require
, I notice different behavior between auto-import and Ctrl+Space
suggestion.
The specific case I face the most often is that I write a unit test, I add require
or assert
statement like assert.Equal(...)
then when I save, the "wrong" import is added (I say wrong just because it's not the one I wanted).
If I instead write assert.Equal(...)
then place my cursor right after assert
(between t
and .
) then I do Ctrl+Space
to see suggestions, then the first listed is the one I would like to actually use. It could be a coincidence and they are simply alphabetically sorted.
So I was wondering what is the way auto-import
decides which import to pick to resolve a particular package? Is there anyway currently to "tweak" this behavior a bit maybe provide a list of my preferred resolution?
Beta Was this translation helpful? Give feedback.