Skip to content

Commit

Permalink
gopls/internal/lsp/cache: two minor simplifications
Browse files Browse the repository at this point in the history
While reading the code during talk prep, I noticed these
two places where the code was unclear.

Change-Id: I1c9d60a9abf78592422c165ef74b7d5414d5d400
Reviewed-on: https://go-review.googlesource.com/c/tools/+/502535
TryBot-Bypass: Alan Donovan <[email protected]>
Run-TryBot: Alan Donovan <[email protected]>
gopls-CI: kokoro <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
  • Loading branch information
adonovan committed Jun 12, 2023
1 parent db6a81e commit c59d87f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions gopls/internal/lsp/cache/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,7 @@ func (b *packageHandleBuilder) validatePackageHandle(prevPH, ph *packageHandle)

// Opt: if no dep keys have changed, we need not re-evaluate the key.
if prevPH != nil {
depsChanged := true
depsChanged = false
depsChanged := false
assert(len(prevPH.depKeys) == len(ph.depKeys), "mismatching dep count")
for id, newKey := range ph.depKeys {
oldKey, ok := prevPH.depKeys[id]
Expand All @@ -995,7 +994,6 @@ func (b *packageHandleBuilder) validatePackageHandle(prevPH, ph *packageHandle)
break
}
}

if !depsChanged {
return nil // key cannot have changed
}
Expand All @@ -1010,10 +1008,8 @@ func (b *packageHandleBuilder) validatePackageHandle(prevPH, ph *packageHandle)
// A predecessor failed to build due to e.g. context cancellation.
return fmt.Errorf("missing transitive refs for %s", dep.m.ID)
}
for name, set := range trefs {
if token.IsExported(name) {
reachable.Union(set)
}
for _, set := range trefs {
reachable.Union(set)
}
}

Expand Down

0 comments on commit c59d87f

Please sign in to comment.