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/gopls: scaling multi-module workspaces #41558
Comments
Nothing in the entire Go codebase uses dbus. You have some exotic setup involving a wrapper for the go command, an LD_PRELOAD, or a |
What makes you think this? I don't actually have any of the above. Per the log file, I've simply opened Vim in my home directory. FYI I bisected this to 78fed78 |
Sorry, I assumed that this was an error from the Go command. We probably need better error messages in this area. I assume you've enabled @stamblerre, I guess this is a question of whether we should be ignoring errors while walking directories looking for go.mod files. |
No I haven't |
Change https://golang.org/cl/256578 mentions this issue: |
Ah, I specifically changed it so that we would always look for workspace modules even without |
I don't think that's good practice -- this code is known to be at least somewhat unstable, and if it's not guarded behind a flag we run the risk of breaking users the next time we release. We got lucky that Paul noticed this first. |
I'd tend to agree. Is the plan with this new workspace module, when enabled, to recursively scan the directory in which the editor/ |
Previous discussion of a related topic/issue: #35818 |
While it's true that users shouldn't see issues caused by experimental features while working the default mode, I'm not too concerned about this particular case. This seems like something we wouldn't have tested for, so it's really a matter of catching it now versus catching it before we enable multi-module workspaces by default. I do agree that we're lucky Paul noticed -- thank you for reporting!
Yep--we are now walking the workspace root looking for |
Is this approach going to scale when, as I did, someone opens an editor in their home directory? |
I guess I'm not totally clear on the benefits of such a scan, vs adding modules when files from a module are opened in
|
I'm sorry, the issue got closed when I merged the CL. I'll reopen it and link it to the multi-module workspace umbrella issue (#32394), since this sounds more like a fundamental discussion about the multi-module workspace design. To answer your question--the idea behind the scan is to support features like diagnostics and find-references, etc. across multiple or nested modules automatically. It may be a good idea to consider factoring in "depth" however--you're right that someone who opens their home directory would probably not want an enormous multi-module workspace. We could potentially incrementally add modules to the workspace as files are opened, but that does open up the possibility of non-deterministic results for features like find references. And monorepos might have many modules nested below a top-level directory, so distinguishing these cases would be difficult. As of right now, opening your What do you think, @heschik? |
I don't think we've spent enough time designing the UX for multi-module mode, so I don't think I have enough groundwork to give a good answer. I don't think a hardcoded limit either on depth or module count is the answer though. My first thought is that we should ask the user what they want at startup, but that could be annoying. I believe that the previous behavior would have been for the folder to be detected as a misconfigured workspace, and then we'd do a Load on |
I think the goal of that was to spare the user the cost of an initial workspace load on every module beneath their $HOME directory. Asking the user what they want would be reasonable if we could could cache their answer on disk, but even then, a user might change their mind later on, so we'd need to have the UX for them to switch. Maybe if we discover some very large number of modules (10+?), we could warn the user that we're about to load them before we do so? |
Change https://golang.org/cl/257137 mentions this issue: |
This feels like a sensible starting point.
Isn't the issue that with such an approach you will load a totally arbitrary selection of the modules beneath the working directory that may or may not (likely not) coincide with what the user wants?
To my mind, this goes all the way back to the conversation we had a GopherCon last year, the UI/UX around workspace configuration in an editor. Because simply having a module open does not imply (to my understanding) that the user does want it to be part of the multi module magic, hence I guess you reference to "have the UX for them to switch"? |
Change https://golang.org/cl/268877 mentions this issue: |
If the user opens a parent directory of a single module, we can load their workspace without using some of the workarounds of experimental workspace mode, simply by narrowing the workspace to this nested subdirectory. Do this by extending findAllModules to support a limit on the number of modules and files to search. Updates golang/go#41558 Fixes golang/go#42108 Change-Id: Idba800a0deaeee5137d46f16a30b2012ff902a36 Reviewed-on: https://go-review.googlesource.com/c/tools/+/268877 Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Trust: Robert Findley <rfindley@google.com>
After enabling It takes several seconds to update type info on files I'm working on, let alone provide code completion, and that's on a modern powerful laptop. The editor feedback is so slow that I'm going to disable the Would be happy to share debugging data it that helps. |
Sorry to hear that, @rhcarvalho. If the projects you are working on are public, or if you can share a log, we can take a look and try to understand the issue. |
@stamblerre thanks and sorry for I haven't gotten back to you earlier. I've just upgraded to v0.5.4 and decided to re-enable multi-module to give it another try. The initial 5min impression is things got better, thank you! |
The latest version of
@stamblerre - is the latest thinking #41558 (comment)? As I said above, I don't think we should be doing a scan in the first place when there is no trigger to do so. Such triggers to my mind would be opening a Nor do I think we should be suggesting the user not open that directory again or recommend they create a |
I think this is a result of the fundamental difference between Maybe we can consider some alternatives, like waiting to initialize if there are no open Go files and the Go code is only in subdirectories, but that would be tricky to get right. Right now, |
We could yes, but...
My point is that if it's difficult for From our side we'll look at what we can do in any case. |
As an example of an edge case that either |
Hi, I met the same error message with VSCode/gopls.
Any idea how to proceed in order to have gopls working again ? Is there any limit/budget to rise for gopls to work ? thks in advance |
@thomaspeugeot: Can you please file a new issue with your |
Hi
Today, I have tried to reproduce the bug from a clean repo. Problem vanished. Sorry.
BR
Thomas
Envoyé depuis Yahoo Mail pour iPhone
Le dimanche, février 14, 2021, 1:14 AM, Rebecca Stambler <notifications@github.com> a écrit :
@thomaspeugeot: Can you please file a new issue with your gopls logs attached? Information on how to provide this information can be found here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Another datapoint in this investigation is that the package load does not appear to be interruptible. So for example if I open |
@findleyr kindly shared some thoughts on the old question of "when should The current model is that The conclusion to our conversation: it makes sense to switch to a model of Thank you to @stamblerre, @heschi, @findleyr and others for your patience as I have slowly reached this position 😄 |
Hi, I'm just going through old issues, and I'm not sure what to do with this one. The problem of configuring a workspace has moved to go.work, and is covered by (in-progress) gopls support for go.work files with 1.18. The problem of general scalability is covered by (many) other issues. This issue seems to be about finding a workspace that gopls can handle without blowing up. With 1.18, the way to do that will be to configure go.work accordingly. In the future, we hope that gopls can handle much larger workspaces than it currently handles. So, I'm closing this issue as having run its course. Please reopen if I missed something. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Opened
govim
in my home directory.What did you expect to see?
No error messages from
gopls
What did you see instead?
Log file: bad.log
cc @stamblerre
FYI @leitzler
The text was updated successfully, but these errors were encountered: