mirror of https://github.com/golang/go.git
internal/lsp/cache: remove unsynchronized write to snapshot.files
snapshot.GetVersionedFile already memoizes the file handle in snapshot.files. There is no reason to do another write, and this write is unsynchronized. Fixes golang/go#50747 Change-Id: Ib196395135de6f22dd59169accb756665ad10e58 Reviewed-on: https://go-review.googlesource.com/c/tools/+/380214 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
342596760e
commit
e7c9de23ff
|
|
@ -396,11 +396,10 @@ func (s *snapshot) locateTemplateFiles(ctx context.Context) {
|
||||||
excluded := pathExcludedByFilter(relpath, dir, s.view.gomodcache, s.view.options)
|
excluded := pathExcludedByFilter(relpath, dir, s.view.gomodcache, s.view.options)
|
||||||
if fileHasExtension(path, suffixes) && !excluded && !fi.IsDir() {
|
if fileHasExtension(path, suffixes) && !excluded && !fi.IsDir() {
|
||||||
k := span.URIFromPath(path)
|
k := span.URIFromPath(path)
|
||||||
fh, err := s.GetVersionedFile(ctx, k)
|
_, err := s.GetVersionedFile(ctx, k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
s.files[k] = fh
|
|
||||||
}
|
}
|
||||||
searched++
|
searched++
|
||||||
if fileLimit > 0 && searched > fileLimit {
|
if fileLimit > 0 && searched > fileLimit {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue