internal/lsp/cache: preserve OS environment

In https://golang.org/cl/265237 I accidentally lost the os.Environ()
call, so we weren't using the OS environment as the defaults any more.

Change-Id: Id36e3c04f3c13d512b0b71b8d73ed086d9ee9f1d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/266337
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Heschi Kreinick 2020-10-29 13:59:03 -04:00
parent 690a3c245f
commit e7a17c4c13
1 changed files with 1 additions and 1 deletions

View File

@ -242,7 +242,7 @@ func (s *snapshot) RunGoCommandPiped(ctx context.Context, mode source.Invocation
func (s *snapshot) goCommandInvocation(ctx context.Context, mode source.InvocationMode, inv *gocommand.Invocation) (tmpURI span.URI, updatedInv *gocommand.Invocation, cleanup func(), err error) {
s.view.optionsMu.Lock()
inv.Env = append(append(append([]string{}, s.view.options.EnvSlice()...), inv.Env...), "GO111MODULE="+s.view.go111module)
inv.Env = append(append(append(os.Environ(), s.view.options.EnvSlice()...), inv.Env...), "GO111MODULE="+s.view.go111module)
inv.BuildFlags = append([]string{}, s.view.options.BuildFlags...)
s.view.optionsMu.Unlock()
cleanup = func() {} // fallback