Skip to content

Commit c353b05

Browse files
committed
internal/lsp/cache: delete checkSnapshotLocked
Now that the entire metadata graph and workspace packages are derived from metadata, there should be no need to validate coherency. This results in a small improvement to didChange benchmarking (within statistical noise). For golang/go#45686 Change-Id: I32683e025f42d768d62864683e55d4c00146a31c Reviewed-on: https://go-review.googlesource.com/c/tools/+/340855 TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Run-TryBot: Robert Findley <[email protected]>
1 parent 567c98b commit c353b05

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

internal/lsp/cache/snapshot.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"golang.org/x/tools/internal/event"
3131
"golang.org/x/tools/internal/gocommand"
3232
"golang.org/x/tools/internal/lsp/bug"
33-
"golang.org/x/tools/internal/lsp/debug/log"
3433
"golang.org/x/tools/internal/lsp/debug/tag"
3534
"golang.org/x/tools/internal/lsp/source"
3635
"golang.org/x/tools/internal/memoize"
@@ -1638,29 +1637,6 @@ func generationName(v *View, snapshotID uint64) string {
16381637
return fmt.Sprintf("v%v/%v", v.id, snapshotID)
16391638
}
16401639

1641-
// checkSnapshotLocked verifies that some invariants are preserved on the
1642-
// snapshot.
1643-
func checkSnapshotLocked(ctx context.Context, s *snapshot) {
1644-
// Check that every go file for a workspace package is identified as
1645-
// belonging to that workspace package.
1646-
for wsID := range s.workspacePackages {
1647-
if m, ok := s.meta.metadata[wsID]; ok {
1648-
for _, uri := range m.GoFiles {
1649-
found := false
1650-
for _, id := range s.meta.ids[uri] {
1651-
if id == wsID {
1652-
found = true
1653-
break
1654-
}
1655-
}
1656-
if !found {
1657-
log.Error.Logf(ctx, "workspace package %v not associated with %v", wsID, uri)
1658-
}
1659-
}
1660-
}
1661-
}
1662-
}
1663-
16641640
// unappliedChanges is a file source that handles an uncloned snapshot.
16651641
type unappliedChanges struct {
16661642
originalSnapshot *snapshot
@@ -1684,8 +1660,6 @@ func (s *snapshot) clone(ctx, bgCtx context.Context, changes map[span.URI]*fileC
16841660
s.mu.Lock()
16851661
defer s.mu.Unlock()
16861662

1687-
checkSnapshotLocked(ctx, s)
1688-
16891663
newGen := s.view.session.cache.store.Generation(generationName(s.view, s.id+1))
16901664
bgCtx, cancel := context.WithCancel(bgCtx)
16911665
result := &snapshot{

0 commit comments

Comments
 (0)