Skip to content

Commit

Permalink
internal/lsp/cache: fix data races to view.options
Browse files Browse the repository at this point in the history
Use the concurrency-safe view.Options method.

Fixes golang/go#54214

Change-Id: If75a544ae477ee7361540c3933a18e3366d8ffd7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/420954
Run-TryBot: Robert Findley <[email protected]>
gopls-CI: kokoro <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Dylan Le <[email protected]>
  • Loading branch information
findleyr committed Aug 3, 2022
1 parent 0d04f65 commit ddb90ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/lsp/cache/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (s *snapshot) load(ctx context.Context, allowNetwork bool, scopes ...interf
}

moduleErrs := make(map[string][]packages.Error) // module path -> errors
filterer := buildFilterer(s.view.rootURI.Filename(), s.view.gomodcache, s.view.options)
filterer := buildFilterer(s.view.rootURI.Filename(), s.view.gomodcache, s.view.Options())
newMetadata := make(map[PackageID]*KnownMetadata)
for _, pkg := range pkgs {
// The Go command returns synthetic list results for module queries that
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/cache/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (s *snapshot) locateTemplateFiles(ctx context.Context) {
relativeTo := s.view.folder.Filename()

searched := 0
filterer := buildFilterer(dir, s.view.gomodcache, s.view.options)
filterer := buildFilterer(dir, s.view.gomodcache, s.view.Options())
// Change to WalkDir when we move up to 1.16
err := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
if err != nil {
Expand Down

0 comments on commit ddb90ec

Please sign in to comment.