-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/cmd/goimports: weird behaviours - not importing and removing dependencies automatically #34518
Comments
I don't see anything suspicious in the provided |
CC @matloob |
I've re-tried now and it ?seems it works? (using |
Okay, I did some extra digging today. Basically, I have this mono-repo with all services for this project. If When |
Yes, |
What would be the behaviour of |
It will be able to find things that are in the module cache, but probably not much else, since it won't know what the import path of anything should be without knowing the module in use. Closing, since there doesn't seem to be a bug here. For better or worse, most module-aware tools need to be run in the right working directory. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, it does
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Using
goimports -w file.go
or throughvim-go
.What did you expect to see?
Dependencies (external or internal) should be auto imported.
What did you see instead?
It doesn't auto-import packages from the same project/module, it doesn't fetch external packages and sometimes, even if I add import statements manually it scrapes it. Example: I am using
strconv.itoa
and even if I add strconv to imports statement, goimports removes it.I thought initially it was a vim-go issue, but I've tried
goimports -w file.go
and it doesn't as expected.Side note: if I run
go get ...
, it doesn't scrape the dependency.The text was updated successfully, but these errors were encountered: