go/refactor/rename
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
..
check.go refactor/...: remove go1.8-tagged files 2016-11-04 21:29:48 +00:00
mvpkg.go refactor/rename: re-enable TestMoves on Windows 2019-02-12 21:30:38 +00:00
mvpkg_test.go refactor/rename: re-enable TestMoves on Windows 2019-02-12 21:30:38 +00:00
rename.go refactor/rename: remove extraneous space 2019-06-24 15:07:48 +00:00
rename_test.go all: fix tests in preparation for GO111MODULE=on by default 2020-09-17 22:14:52 +00:00
spec.go refactor/rename: fail cleanly when attempting to rename cgo files 2017-06-23 01:23:57 +00:00
util.go refactor/...: remove go1.8-tagged files 2016-11-04 21:29:48 +00:00