x/tools/gopls: duplicate module in workspace with experimentalWorkspaceModule #45184
Comments
Thanks for filing this issue. It looks like your Go module cache ( Also, can you please share your |
Hi @stamblerre , Yes, Thanks! |
It looks like you need to add
It is pretty atypical for the module cache to be in the workspace, so I would suggest avoiding that if at all possible. It won't work with experimental workspace module mode because you will run into this exact problem that you're seeing with the duplicate modules--experimental workspace mode does not support multiple modules with the same path and different versions in the workspace. If necessary, you can configure a module cache that is outside of your GOPATH by using the GOMODCACHE environment variable. |
@stamblerre, Please find the attachment for verbose logs. gopls-vscode-duplicate-workspace-error-logs.log On move my module cache to different path, Would I be able to copy the content from current cache and put it in different path? Or would it have to be loaded when |
I would create an empty directory that you want to use for your new module cache, set the GOMODCACHE variable to point to that directory, and then your module cache will be populated automatically whenever you build your code or open the editor. There is no need to manually populate it. |
It looks like the |
Yeah, I could see that this has been used in multiple place. I fixed it. Now, I'm seeing different issue. Below is the screenshot. These are from the GoKafka package. Should I replace the module name? I have added the filter Also, I have one another issue. When I hover on any function/variable/anything, I don't see any definition. Should I enable any specific setting to enable this? |
Issue
I use multi-module workspace (kinda monorepo). I'm getting below error from gopls for all the modules in pkg -
I found I have different versions of sarama. But I believe that is not causing this. because, The error is pointing all the modules. I have attached the screenshot with this for more details.
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
What did you do?
gopls
settingsWhat did you expect to see?
No errors or warnings.
What did you see instead?
Error that says
Below is the screenshot of error:
The text was updated successfully, but these errors were encountered: