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

internal/gocommand: don't delete command's environment

My fix in CL 225817 introduced another bug :)

Fixes golang/go#38101

Change-Id: I3de1a051d3e86474c6aa0fb0e427a590438e2172
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226257
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-03-27 16:54:39 -04:00
parent 82bb89366a
commit 3db5fc6bac

View File

@ -78,7 +78,7 @@ func (i *Invocation) RunPiped(ctx context.Context, stdout, stderr io.Writer) err
// The Go stdlib has a special feature where if the cwd and the PWD are the
// same node then it trusts the PWD, so by setting it in the env for the child
// process we fix up all the paths returned by the go command.
cmd.Env = append([]string{}, i.Env...)
cmd.Env = append([]string{}, append(i.Env, cmd.Env...)...)
if i.WorkingDir != "" {
cmd.Env = append(cmd.Env, "PWD="+i.WorkingDir)
cmd.Dir = i.WorkingDir