1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:14:45 -07:00

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>
This commit is contained in:
Rebecca Stambler 2020-08-10 23:49:48 -04:00
parent d77521d074
commit 48a8ffc5b2

View File

@ -126,10 +126,10 @@ type View struct {
// 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 @@ func (v *View) setBuildConfiguration() (isValid bool) {
}()
// 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 @@ func (v *View) setGoEnv(ctx context.Context, configEnv []string) (string, error)
// 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
}