Once you add a Golang Workspace by creating a go.work file, every go.mod file returns error: no go.mod file found in /home/skipr/Dev/workspace go list. Where /home/skipr/Dev/workspace is the root of the workspace.
Steps to reproduce the behavior:
Start with a blank directory
Create a folder hello
Start a Go module using go mod init example.com/hello (run inside hello directory)
Create hello/main.go containing
Start a Go workspace using go work init ./hello (run inside root/workspace directory)
Adding a go.mod to the root doesn't solve the issue. Nor adding . to the go.work. When doing the latter, you even get the same error in the root go.mod:
Screenshots or recordings
The text was updated successfully, but these errors were encountered:
Thanks for the fast response! I tried to remove the option as well, but just realize I only removed it from my workspace config in VS Code, not from my user config. So, it was still active from gopls' point-of-view.
It was easy to find the bug thanks to your detailed report!
Unfortunately, this is a case where the 'allowModfileModifications' flag has deep implications into the behavior of gopls, and therefore should really be tested against the entire gopls test suite (but isn't).
AFAIK very few people use this setting, and I'd love to deprecate it in favor of go.mod code-lens. Can you share why you have it enabled?