if ctxt.CgoEnabled {
cgo = "1"
}
- cmd.Env = append(os.Environ(),
+ cmd.Env = append(cmd.Environ(),
"GOOS="+ctxt.GOOS,
"GOARCH="+ctxt.GOARCH,
"GOROOT="+ctxt.GOROOT,
"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())