зеркало из https://github.com/golang/tools.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:
Родитель
342596760e
Коммит
e7c9de23ff
|
@ -396,11 +396,10 @@ func (s *snapshot) locateTemplateFiles(ctx context.Context) {
|
|||
excluded := pathExcludedByFilter(relpath, dir, s.view.gomodcache, s.view.options)
|
||||
if fileHasExtension(path, suffixes) && !excluded && !fi.IsDir() {
|
||||
k := span.URIFromPath(path)
|
||||
fh, err := s.GetVersionedFile(ctx, k)
|
||||
_, err := s.GetVersionedFile(ctx, k)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
s.files[k] = fh
|
||||
}
|
||||
searched++
|
||||
if fileLimit > 0 && searched > fileLimit {
|
||||
|
|
Загрузка…
Ссылка в новой задаче