Our internal version control system is working over fuse. Big mono-repository is mounted as a virtual file system and loaded lazily on demand. Whole repository is a single go module with single go.mod file at the root.
When I open subset of big mono-repository in vscode, gopls starts walking all directories of the repository, breaking lazy load.
What did you expect to see?
gopls should interact only with directories added to workspace.
The text was updated successfully, but these errors were encountered:
gopherbot
added
Tools
This label describes issues relating to any tools in the x/tools repository.
gopls
Issues related to the Go language server, gopls.
labels
May 19, 2022
Thanks for the issue, and for the patch. We should reuse the directoryFilters setting, or go.work files, rather than add a new setting. But otherwise what you did looks good.
Rationalizing these settings with go.work is in the plan for gopls@v0.9.0, so I'm including this in that milestone (our next release).
My workspace consists of multiple folders. directoryFilter is evaluated relative to each directory. But import cache filter should be evaluated relative to module root.
Because of this issue, I added separate setting in my proof-of-concept patch.
It is possible to reuse directoryFilter, but this would require changing semantics in case where workspace directory is not module root.
gopls version
go env
What did you do?
Our internal version control system is working over fuse. Big mono-repository is mounted as a virtual file system and loaded lazily on demand. Whole repository is a single go module with single go.mod file at the root.
When I open subset of big mono-repository in vscode, gopls starts walking all directories of the repository, breaking lazy load.
What did you expect to see?
gopls should interact only with directories added to workspace.
What did you see instead?
gopls scans all directories of a go module.
This issue originates imports cache. https://github.com/golang/tools/blob/cf66aec62b42a726b36e083c001d3b3231cba2b3/internal/imports/fix.go#L675-L689
It loads all directories from disk without any way of setting up excludes.
I tried adding exclude filter to gopls configuration. This patch fixed issue for me: slon/tools@bfcfbb1
Editor and settings
Logs
The text was updated successfully, but these errors were encountered: