1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:34:40 -07:00

internal/lsp: replace mistaken "break" with "continue"

I had meant to continue instead of break this loop. This caused us to
invalidate all IDs (except for those for one file) every time a snapshot
was cloned.

Picked up a staticcheck fix along the way.

Change-Id: I8fb3b2bdd6b58ac21130e01cb0d32fa6a57e6b73
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221103
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rohan Challa <rohan@golang.org>
This commit is contained in:
Rebecca Stambler 2020-02-26 12:10:06 -05:00
parent abb57c682a
commit 020676185e

View File

@ -131,7 +131,7 @@ func (s *snapshot) buildOverlay() map[string][]byte {
func (s *snapshot) PackageHandles(ctx context.Context, fh source.FileHandle) ([]source.PackageHandle, error) { func (s *snapshot) PackageHandles(ctx context.Context, fh source.FileHandle) ([]source.PackageHandle, error) {
if fh.Identity().Kind != source.Go { if fh.Identity().Kind != source.Go {
panic(fmt.Sprintf("called PackageHandles on a non-Go FileHandle")) panic("called PackageHandles on a non-Go FileHandle")
} }
ctx = telemetry.File.With(ctx, fh.Identity().URI) ctx = telemetry.File.With(ctx, fh.Identity().URI)
@ -743,7 +743,7 @@ outer:
for k, ids := range s.ids { for k, ids := range s.ids {
for _, id := range ids { for _, id := range ids {
if invalidateMetadata, ok := transitiveIDs[id]; invalidateMetadata && ok { if invalidateMetadata, ok := transitiveIDs[id]; invalidateMetadata && ok {
break outer continue outer
} }
} }
result.ids[k] = ids result.ids[k] = ids