Skip to content

Commit bfc1674

Browse files
committed
internal/lsp/cache: fix loading of std and cmd
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 <[email protected]> Run-TryBot: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent d824a74 commit bfc1674

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/lsp/cache/load.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ func (s *snapshot) load(ctx context.Context, allowNetwork bool, scopes ...interf
8787
}
8888
query = append(query, fmt.Sprintf("file=%s", uri.Filename()))
8989
case moduleLoadScope:
90-
query = append(query, fmt.Sprintf("%s/...", scope))
90+
switch scope {
91+
case "std", "cmd":
92+
query = append(query, string(scope))
93+
default:
94+
query = append(query, fmt.Sprintf("%s/...", scope))
95+
}
9196
case viewLoadScope:
9297
// If we are outside of GOPATH, a module, or some other known
9398
// build system, don't load subdirectories.

0 commit comments

Comments
 (0)