Skip to content

Commit

Permalink
internal/lsp/cache: fix loading of std and cmd
Browse files Browse the repository at this point in the history
The go/packages queries std/... and cmd/... don't work. I believe
they're supposed to be just "std" and "cmd" based on experimentation
(and stdlib_test.go), but I didn't see this explicitly documented.

Fixes golang/go#46901

Change-Id: I3d0ed48fa64a50eefe4b5cc6074a93455cd37dc8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/330529
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
  • Loading branch information
findleyr committed Jun 24, 2021
1 parent d824a74 commit bfc1674
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/lsp/cache/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ func (s *snapshot) load(ctx context.Context, allowNetwork bool, scopes ...interf
}
query = append(query, fmt.Sprintf("file=%s", uri.Filename()))
case moduleLoadScope:
query = append(query, fmt.Sprintf("%s/...", scope))
switch scope {
case "std", "cmd":
query = append(query, string(scope))
default:
query = append(query, fmt.Sprintf("%s/...", scope))
}
case viewLoadScope:
// If we are outside of GOPATH, a module, or some other known
// build system, don't load subdirectories.
Expand Down

0 comments on commit bfc1674

Please sign in to comment.