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: unable to use workspace mode due to misuse of -mod flag #48186
Comments
It's possible this is caused by govim, as per @leitzler on Slack:
And @heschi then mentioned:
|
It would be helpful with a repro from my point of view, I can give it a look into the
I do however the setting I linked in my config (the default value is 1/true): (EDIT: it works without it as well)
Also had to enable workspace modules using:
|
Thanks for the report. @mvdan have you tried |
I haven't had more time to dig into this or try again :) I also did not enable workspace support in gopls via |
Agreed, which is why I'm suspicious of this govim setting. I can investigate and try to repro, but it will probably take a few days for me to get to this. If it's easy for you try unsetting this experimental feature in govim, that would help narrow it down. |
Change https://golang.org/cl/347593 mentions this issue: |
Workspace mode only allows -mod to be set to 'readonly'. When returning the error for other values of -mod, specify the the value in the error so it's easier to see what's going on when the go command is invoked through another tool. For #45713, #48186 Change-Id: I3ba206a71c7a20c18aeccfa48f3c9dc935a180a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/347593 Trust: Michael Matloob <matloob@golang.org> Trust: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Ever since I disabled ExperimentalAllowModfileModifications, I haven't run into this error again. So I think the blame should indeed be put on that option being on when it shouldn't be. I've filed govim/govim#1112 to fix that in govim. I think we can close this issue for now, unless others run into similar errors with gopls again (with that experimental setting turned off!). |
The previous default value for for the config setting ExperimentalAllowModfileModifications was "true", which isn't the default value for gopls. Enabling this setting causes issues with the new workspace mode in gopls as described in #1112 and referred golang/go#48186. It also seem to cause issues in upcoming Go 1.18, see golang/go#51056. Closes #1112
The previous default value for for the config setting ExperimentalAllowModfileModifications was "true", which isn't the default value for gopls. Enabling this setting causes issues with the new workspace mode in gopls as described in #1112 and referred golang/go#48186. It also seem to cause issues in upcoming Go 1.18, see golang/go#51056. Closes #1112
The previous default value for for the config setting ExperimentalAllowModfileModifications was "true", which isn't the default value for gopls. Enabling this setting causes issues with the new workspace mode in gopls as described in #1112 and referred golang/go#48186. It also seem to cause issues in upcoming Go 1.18, see golang/go#51056. Closes #1112
gopls @v0.0.0-20210902182115-3b801c8b8389
go version devel go1.18-ab7c904bf2 Fri Sep 3 05:27:58 2021 +0000 linux/amd64
I'm trying #45713; I've set up a fairly simple go.work file as follows:
And I've hit "go to definition" in ipfs, which should take me to a file within the multicodec module. This works without the workspace file; it just takes me inside the module download cache.
However, it just errors:
It appears gopls is calling cmd/go with a -mod value other than "readonly" somewhere, which is not supported by workspace mode.
I'm happy to provide precise repro steps here, since all this code is open source after all, but I also imagine this is enough detail for you to figure out what you need.
cc @matloob @stamblerre
The text was updated successfully, but these errors were encountered: