Since these commands already include an explicit Env field,
they will not be fixed automatically by proposal #50599.
Change-Id: Ia8157a71cf0cfe208bdc0da9aef54be3d26c795f
Reviewed-on: https://go-review.googlesource.com/c/go/+/391804
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
Trust: Daniel Martà <mvdan@mvdan.cc>
"GOPATH="+ctxt.GOPATH,
"CGO_ENABLED="+cgo,
)
+ if cmd.Dir != "" {
+ // If possible, set PWD: if an error occurs and PWD includes a symlink, we
+ // want the error to refer to Dir, not some other name for it.
+ if abs, err := filepath.Abs(cmd.Dir); err == nil {
+ cmd.Env = append(cmd.Env, "PWD="+abs)
+ }
+ }
if err := cmd.Run(); err != nil {
return fmt.Errorf("go/build: go list %s: %v\n%s\n", path, err, stderr.String())