internal/lsp: fix tiny bug in getting files by basename
This change fixes gopls on Windows.
Fixes golang/go#30967
Change-Id: Iba5eb6932a4acd6a574ad6970faf7c133ecb7d32
Reviewed-on: https://go-review.googlesource.com/c/tools/+/169703
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go
index d8f609c..1868852 100644
--- a/internal/lsp/cache/view.go
+++ b/internal/lsp/cache/view.go
@@ -234,7 +234,7 @@
basename := basename(fname)
if candidates := v.filesByBase[basename]; candidates != nil {
pathStat, err := os.Stat(fname)
- if err == nil {
+ if err != nil {
return nil
}
for _, c := range candidates {