go/internal/imports
Jay Conrod 3791637d67 all: fix tests in preparation for GO111MODULE=on by default
This CL does not fix failures in ./gopls/internal/regtest, which will
be fixed separately.

In refactor/rename.TestDiff, add a go.mod file.

In internal/imports.ProcessEnv.buildContext, set an I/O hook if
GO111MODULE=off in ProcessEnv but not in the current process's
environment.

Context allows the user to set GOPATH, GOOS, GOARCH, and a few other
environment variables, but not GO111MODULE. Context.Import may return
different results than packages.Load if the latter is invoked with a
GO111MODULE value that differs from the caller's environment. Setting
an I/O hook forces Import to run in GOPATH mode, not invoking 'go list'.
This is undocumented, but it should be stable while GOPATH is
supported.

For golang/go#41330

Change-Id: I5679e8941e32dc95b05c234cb2e3fec5cabebced
Reviewed-on: https://go-review.googlesource.com/c/tools/+/255398
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
2020-09-17 22:14:52 +00:00
..
testdata/mod imports: rename to internal/imports 2019-05-20 21:49:35 +00:00
fix.go all: fix tests in preparation for GO111MODULE=on by default 2020-09-17 22:14:52 +00:00
fix_test.go internal/imports: support completing import paths 2020-08-20 18:00:31 +00:00
imports.go internal/imports: require valid options, move LocalPrefix up 2020-07-07 20:02:13 +00:00
imports_test.go internal/imports: require valid options, move LocalPrefix up 2020-07-07 20:02:13 +00:00
mkindex.go imports: rename to internal/imports 2019-05-20 21:49:35 +00:00
mkstdlib.go internal/imports: update stdlib index for 1.15 2020-08-04 21:03:08 +00:00
mod.go internal/imports: fix crash when adding stdlib imports 2020-08-13 17:47:04 +00:00
mod_cache.go internal/imports: stop leaking listeners 2020-02-04 05:47:48 +00:00
mod_cache_test.go internal/imports: clean up dead code 2019-12-30 21:21:44 +00:00
mod_test.go internal/imports: fix crash when adding stdlib imports 2020-08-13 17:47:04 +00:00
sortimports.go internal/imports: require valid options, move LocalPrefix up 2020-07-07 20:02:13 +00:00
zstdlib.go internal/imports: update stdlib index for 1.15 2020-08-04 21:03:08 +00:00