diff --git a/internal/lsp/cache/load.go b/internal/lsp/cache/load.go index 46ecd7e606..15fcf5810c 100644 --- a/internal/lsp/cache/load.go +++ b/internal/lsp/cache/load.go @@ -8,6 +8,7 @@ import ( "context" "fmt" "go/types" + "sort" "strings" "golang.org/x/tools/go/packages" @@ -41,14 +42,10 @@ func (s *snapshot) load(ctx context.Context, scopes ...interface{}) ([]*metadata var query []string for _, scope := range scopes { switch scope := scope.(type) { - case []packagePath: + case packagePath: // The only time we pass package paths is when we're doing a // partial workspace load. In those cases, the paths came back from // go list and should already be GOPATH-vendorized when appropriate. - for _, p := range scope { - query = append(query, string(p)) - } - case packagePath: query = append(query, string(scope)) case fileURI: query = append(query, fmt.Sprintf("file=%s", span.URI(scope).Filename())) @@ -74,6 +71,8 @@ func (s *snapshot) load(ctx context.Context, scopes ...interface{}) ([]*metadata panic(fmt.Sprintf("unknown scope type %T", scope)) } } + sort.Strings(query) // for determinism + ctx, done := trace.StartSpan(ctx, "cache.view.load", telemetry.Query.Of(query)) defer done()