Skip to content
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: directoryFilters are mishandled when descending the workspace root to find a go.mod file #45340

wtlangford opened this issue Apr 1, 2021 · 2 comments


Copy link

@wtlangford wtlangford commented Apr 1, 2021

What did you do?

Configured gopls in vscode as follows:

"gopls": {
  "build.directoryFilters": [

Where some/dir/moduleroot contains a go.mod.

What did you expect to see?

gopls detects the go.mod file in some/dir/moduleroot and uses it.

What did you see instead?

gopls did not detect the go.mod file and was unable to resolve any imports.

Build info v0.6.9 h1:LBBcE2y3Tb4bp79JVLWCQBbvYCFEs5ADGWsQDoSLk1Q= h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY= h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= h1:O5bm8buX/OaamnfcBrkjn0SPUIU30jFmaS8lP+ikkxs= h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= h1:EVDuO03OCZwpV2t/tLLxPmPiomagMoBOgfPt0FM+4IY= h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw= h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
@gopherbot gopherbot added this to the Unreleased milestone Apr 1, 2021
Copy link

@heschi heschi commented Apr 1, 2021

I believe I made a stupid mistake in findModules: we don't recurse into a directory that is filtered out, which means that cases exactly like this one won't work. For now it'd probably be easier to recurse unconditionally, but that's unfortunate if the filter is (e.g.) node_modules.

Copy link

@wtlangford wtlangford commented Apr 1, 2021

You could also potentially look to see if there are any later + entries that have the - entry as a prefix and only recurse in that case.

@stamblerre stamblerre removed this from the Unreleased milestone Apr 1, 2021
@stamblerre stamblerre added this to the gopls/v1.0.0 milestone Apr 1, 2021
@stamblerre stamblerre added this to To Do in gopls on-deck Apr 15, 2021
@stamblerre stamblerre moved this from To Do to P2 in gopls on-deck Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants