From 48a8ffc5b207a945a9758bb150d85c2ccfc2686b Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Mon, 10 Aug 2020 23:49:48 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Heschi Kreinick --- internal/lsp/cache/view.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/lsp/cache/view.go b/internal/lsp/cache/view.go index f9a6ba7253..121f2fc3cd 100644 --- a/internal/lsp/cache/view.go +++ b/internal/lsp/cache/view.go @@ -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 }