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: experimentalWorkspaceModule: Incorrectly flags packages as missing in go.sum
#48364
Comments
go.sum
go.sum
go.sum
go.sum
Hi @stamblerre, just giving this a bump. I am very happy to get on a call and replicate the issue with you or contribute to a solution. This would be a great issue to solve to improve the contribution experience for HashiCorp. |
Sorry for the delay on this! I was wondering if you had tried this example using the new |
I will give that a shot! I did not come across the |
I tried that method but it seems to produce an identical error to what I described above. Additionally, the documentation around the What do you think is a good way forward? |
I think it would make sense to check in the /cc @matloob for a potential |
Thank you! I appreciate all the hard work you do on the tools team. Great to hear more about it in the latest Go Time podcast. I am in the Gopher slack and happy to do a call or present on the issue. Whatever makes your job easier. |
Thank you for the kind words, and I appreciate you offering your time to help us investigate! I will chat with @matloob next week, and we'll follow up on scheduling time to investigate. Thanks! |
Just circling back on this. I'm planning on attending the Golang tools session on the 17th to learn a bit more about this issue and what I can do to help solve it. |
Hi, I'm planning to take a look at this after the freeze. Thanks! |
@matloob awesome! Happy to jump on a call or help out in any way I can. |
Change https://golang.org/cl/365737 mentions this issue: |
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?
Summary
I am using the
gopls
setting for experimental workspace modules and getting errors on mygo.mod
files when opening the repository from its root in VS Code which do not match with errors observed when the directories containing thego.mod
files are opened on their own, even with the experimental workspace modules flag set totrue
.I would like to be able to open the repository from its root and have it work correctly so that I can set up the repository for Codespaces and ease the burden on contributors.
Repro Steps
code consul-k8s
. The repository has 4 Go modules in it.settings.json
withCMD
+SHIFT
+P
and entering "Preferences: Open Settings (JSON)".gopls
to usebuild.experimentalWorkspaceModule
by adding the following setting:CMD
+SHIFT
+P
and entering "Developer: Reload Window"../control-plane/go.mod
and./charts/consul/tests/acceptance/go.mod
. These errors do not occur when the directory containing the module itself is opened (e.g.code ./control-plane/
).What did you expect to see?
I would expect the output of
gopls
when running from the root of the project with experimental workspace modules on to match the output when running from the directory containing the module.What did you see instead?
Issue with
acceptance
moduleWhen the
acceptance
module is opened withcode ./charts/consul/test/acceptance
,gopls
does not raise any errors with thego.mod
file. Note that the experimental workspace module flag istrue
and no errors are raised.When the repository is opened from its root,
gopls
raises an issue with thegithub.com/gruntwork-io/terratest v0.31.2
module ingo.mod
.The extension also offers the suggested fix 17 times:
Applying the fix via the quick-fix menu does not fix the problem. It returns the error "Command 'gopls.go_get_package' failed: Error: edits not applied because of ."
However, running the suggested command
go get k8s.io/apimachinery/pkg/util/httpstream/spdy@v0.21.1
from the command line does fix the problem by updating other packages.After this update,
gopls
no longer reports an error on this module. However, I don't think it should have reported the error in the first place as it did not report the error when the directory itself was opened.Issue with
control-plane
moduleI have not been able to solve the similar issue with the
control-plane
module.When the
control-plane
module is opened withcode ./control-plane
,gopls
does not raise any errors with thego.mod
file. Note that the experimental workspace module flag istrue
and no errors are raised.When the repository is opened from its root,
gopls
raises 8 issues with thegithub.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f
module ingo.mod
.It raises this error twice:
this error 5 times
and this error once
It provides the quick fix option for updating the package many times:
As with the
acceptance
module, running the quick-fix solution does not fix the problem. Running the suggested commands in the terminal does not fix the problem either.The text was updated successfully, but these errors were encountered: