go/refactor
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
..
eg all: do not write to testdata directories 2019-08-30 17:05:20 +00:00
importgraph refactor/importgraph: get test to pass when run in modules mode 2019-02-14 19:27:12 +00:00
rename all: fix tests in preparation for GO111MODULE=on by default 2020-09-17 22:14:52 +00:00
satisfy all: fix more typos 2019-09-11 15:13:14 +00:00
README go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00

README

golang.org/x/tools/refactor: libraries for refactoring tools.