go/go/loader
Matthew Dempsky 72e4d1bb8d go/internal/cgo: handle symlinks with $PWD, not -srcdir
In CL 293250, I changed x/tools/go/loader to invoke cgo using the
-srcdir option, rather than chdir'ing into the source directory. But
evidently cgo's -srcdir option does not affect #include processing of
relative file paths, so this ended up breaking packages that relied on
the latter.

This CL reverts back to chdir'ing into the source directory, but also
sets the PWD environment variable. This appears to be how cmd/go
invokes tools and handles symlinks.

Fixes golang/go#46877.

Change-Id: Ia538c5d8722b151a4547f73188f6537e0551136f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/331409
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-29 19:12:30 +00:00
..
testdata go/internal/cgo: handle symlinks with $PWD, not -srcdir 2021-06-29 19:12:30 +00:00
doc.go go/loader: document that package is deprecated 2019-06-24 19:02:45 +00:00
loader.go go/loader: fix race 2021-02-18 23:52:55 +00:00
loader_test.go go/internal/cgo: handle symlinks with $PWD, not -srcdir 2021-06-29 19:12:30 +00:00
stdlib_test.go go/loader: remove check on ioutil.TestTempFile in TestStdlib 2020-04-13 16:19:37 +00:00
util.go go/loader: don't treat unsafe specially wrt vendoring 2016-01-08 20:29:04 +00:00