Change information
Commit message:
gopls/internal/cache: detect testmain without GOCACHE
If someone has a GOCACHEPROG, that GOCACHEPROG may place files outside
of GOCACHE (since reasonably, an outside tool should not put stuff in
GOCACHE; that's Go's domain).
But, isTestMain detected generated testmain files by looking for them
inside GOCACHE, leading to odd errors like:
could not import testing/internal/testdeps (invalid use of internal package "testing/internal/testdeps")
Rather than checking GOCACHE, check and see if the loaded files are just
outside pkg.Dir. In my testing, I was seeing:
pkg.Dir="/home/jake/work/TypeScript-go/internal/parser"
GoFiles=["/home/jake/.cache/gocachez/v1/live/run-1630688891/0da230d43268bd7a7351aefd6900d761eed9c58cd4791093b331b16b6a3bce12-2791091722"]
Which I think is enough of a signal to also be reliable.
Change-Id: I563c10d4ef6dccbfe1cd0ffd5bbd49092b03adfc
Files:
- M gopls/internal/cache/load.go
Change size: S
Delta: 1 file changed, 16 insertions(+), 6 deletions(-)
Branch: refs/heads/master