1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

internal/lsp: fix merge conflict and race condition

Race condition: I deleted the code that acquired the mutex when checking
if a file's imports have changed.

Merge conflict: I submitted a change without rebasing and re-running TryBots.

Change-Id: Iae351f2fff893cfd94db79d9f79578d9827a8c21
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197297
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
Rebecca Stambler 2019-09-25 12:19:15 -04:00
parent 9c4a82ab32
commit 125cfdbd7b
2 changed files with 4 additions and 1 deletions

View File

@ -136,6 +136,9 @@ func (v *view) checkMetadata(ctx context.Context, f *goFile, fh source.FileHandl
// determine if they have changed.
// It assumes that the caller holds the lock on the f.mu lock.
func (v *view) shouldRunGopackages(ctx context.Context, f *goFile, file *ast.File, metadata []*metadata) bool {
f.mu.Lock()
defer f.mu.Unlock()
// Check if the package's name has changed, by checking if this is a filename
// we already know about, and if so, check if its package name has changed.
for _, m := range metadata {

View File

@ -284,7 +284,7 @@ func (c *completer) basicLiteral(T types.Type, typeName string, matchScore float
InsertText: nonSnippet,
Detail: T.String(),
Score: matchScore * literalCandidateScore,
Kind: VariableCompletionItem,
Kind: protocol.VariableCompletion,
snippet: snip,
})
}