/ go Public
x/tools/imports: permission denied causes non-deterministic updating of imports #31285
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
This label describes issues relating to any tools in the x/tools repository.
What version of Go are you using (
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
What did you do?
What did you expect to see?
Consistently see the import added to the file
What did you see instead?
The import is sometime added and sometimes not added.
What I think is happening
The problem appears to be that
addExternalCandidatessometimes sees the package in the vendor dir and sometimes doesn't.
I think it's because it calls
gopathResolver.scanto find a list of all packages
and scan will quit upon the first error it encounters because it uses
Because it quits on the first error, if it reads the vendor dir with the wanted import first, then the import will be there, and if it hits the dir it can't read first, then it will exit without the import.
I think we should always walk the entire tree and walk around unreadable directories rather than aborting the entire walk at that point.
I can see 2 options:
I'm happy to help with making this change as well.
This issue appears similar to #16890 but it seems like that question is more targetted towards what log messages are printed, here I'm more concerned about the actual behavior (which dirs are scanned).
The text was updated successfully, but these errors were encountered: