-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: permission denied causes imports to stop #16890
Comments
Hey guys, happy to help but what should the behaviour be:
I would lean towards 2. Jeff |
1 or 2 seems better. goimports is frequently run from editor hooks, so one important question is how they handle output on stderr. Will be it be presented to the user? If not what's the point, but if so, will it be annoying? Will output on stderr be interpreted as failure and prevent formatting? Given all that I personally lean towards 1. |
goimports has a verbose ( |
Hi guys! |
@luigi-riefolo, no need to use Assignee. Just send a change and drop a comment here with the URL to the Gerrit review. Please use the design I proposed in #16890 (comment) ... we can't be interactive or chatty by default, as we're likely running underneath an editor process. |
@jeffw-wherethebitsroam I've tried to reproduce the issue using the same environment but with no results.
As you can see it specifies the 000 dir. Thank you. |
Hi Luigi, Are you running the goimports from the cloudcp directory? If so, can you try from another directory? Otherwise, I have attached a little example.
Which should show an error like:
Jeff |
Thank you @jeffw-wherethebitsroam for the accurate example.
So apparently we do get the imports for anything after the 000 dir. But please correct if I'm wrong. |
Probably not a great example, it was just to show you the misleading error line. The |
@jeffw-wherethebitsroam thank you for being specific. I'll take in count your observation for my next tests. |
@luigi-riefolo are you still planning on fixing it ? if not I may try to pick it up |
@asticode you can pick it up |
CL https://golang.org/cl/30751 mentions this issue. |
@bradfitz I have tried to fix it according your ideas here and in that last CL, but I fail to see good solution without refactoring many things and adding ugly hook into fastwalk. What if we just improve error report printed? It will help users to see the problematic dir:
Let me know if I need to create separate issue for that. Thank you! |
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
One unreadable dir in GOPATH will cause the walk to fail and ignore all directories after that point, with a confusing message like:
In this case, it was a test dir with permissions 0000:
Admittedly, moving this test content into testdata where it should have been fixed the problem. But this is not very obvious given the error.
The relevant code was golang.org/x/tools/imports/fastwalk_unix.go:
goimports to skip the directory with permission denied. Or at least give an error with the directory which was the problem.
goimports failed to insert the imports for known packages in the file being processed.
The text was updated successfully, but these errors were encountered: