Goland (version 2021.2, on Linux) can't auto import "fmt", when add a line of code that use fmt's functions.
I need to add import "fmt"
by hand.
But seems it doesn't have problem with other built-in go packages.
It that a bug, or a special design ?
BTW, the similar issue occur for 3rd-party package "github.com/stretchr/testify/assert"
, the auto import will hint several options to import assert
, but the above one is always not in the list in my case, had to import
by hand.
Screenshot:
Solution: just remove the 2 line, then import works immediately.
Thanks to s0xzwasd
's comment under question, and jinseok.oh
's answer, which actually mentioned the setting.
There is Global Println() function and also fmt.Println() function()
If you writh Println and press ctl+space only then IDE will set autocomplete Println().
/// add
Also you have to check this. Is there any exclucde from import and completion?
If doesn't exist, then my last advise is doing invalidate caches/ restart