internal/lsp/cache: flip noGopackagesDriver to hasGopackagesDriver
It's not very clear to use double negatives. Follow-up from CL 247817.
Change-Id: Ie162d8e71ce7229bffcb2c419a16f0a08a4b7b74
Reviewed-on: https://go-review.googlesource.com/c/tools/+/247877
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go
index f9a6ba7..121f2fc 100644
--- a/internal/lsp/cache/view.go
+++ b/internal/lsp/cache/view.go
@@ -126,10 +126,10 @@
// Only possible with Go versions 1.14 and above.
tmpMod bool
- // noGopackagesDriver is true if the user has no value set for the
- // GOPACKAGESDRIVER environment variable and no gopackagesdriver binary on
+ // hasGopackagesDriver is true if the user has a value set for the
+ // GOPACKAGESDRIVER environment variable or a gopackagesdriver binary on
// their machine.
- noGopackagesDriver bool
+ hasGopackagesDriver bool
// `go env` variables that need to be tracked by gopls.
gocache, gomodcache, gopath, goprivate string
@@ -796,7 +796,7 @@
}()
// Since we only really understand the `go` command, if the user has a
// different GOPACKAGESDRIVER, assume that their configuration is valid.
- if !v.noGopackagesDriver {
+ if v.hasGopackagesDriver {
return true
}
// Check if the user is working within a module.
@@ -871,7 +871,7 @@
// A user may also have a gopackagesdriver binary on their machine, which
// works the same way as setting GOPACKAGESDRIVER.
tool, _ := exec.LookPath("gopackagesdriver")
- v.noGopackagesDriver = gopackagesdriver == "off" || (gopackagesdriver == "" && tool == "")
+ v.hasGopackagesDriver = gopackagesdriver != "off" && (gopackagesdriver != "" || tool != "")
return gomod, nil
}