1
0
mirror of https://github.com/golang/go synced 2024-09-30 12:18:33 -06:00
go/cmd
Heschi Kreinick e31c80b82c all: rework goimports environment, support GOMODCACHE
This CL got away from me a little.

For a number of reasons, the existing goimports API of passing in values
for various GO* values was not working. For one, the number of necessary
variables kept growing. For another, we tried to avoid calling `go env`
in GOPATH mode by using `build.Default`, but that turns out to be buggy;
see golang/go#39838. And finally, it created massive confusion about
whether the values were intended to be read from the OS environment, or
fully evaluated by the `go` command.

There are only two users of the internal imports API, so there really
shouldn't need to be more than two modes. For the command line tool, we
have to call `go env` to deal with the `go/build` bug. So we just do it.
Tests use that same path, but can augment the enviroment to set
themselves up. In contrast, `gopls` needs to fully specify the
environment. It can simply pass in the fully evaluated GO* values.

Finally, make the change I was actually here to make: propagate
GOMODCACHE and use it where appropriate.

Fixes golang/go#39761.

Change-Id: I720c69839d91d66d98e94dfc5f065ba0279c5542
Reviewed-on: https://go-review.googlesource.com/c/tools/+/239754
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-06-25 17:33:20 +00:00
..
auth cmd/auth/cookieauth: add a GOAUTH implementation that reads from a cookiefile 2019-04-05 18:06:40 +00:00
benchcmp cmd/benchcmp: add deprecation notice 2020-02-10 18:42:41 +00:00
bundle cmd/bundle: add -tags flag 2019-11-04 19:56:21 +00:00
callgraph all: skip tests if required tools are not found 2019-08-30 15:40:57 +00:00
compilebench cmd/compilebench: report rss measurement 2020-03-18 03:17:18 +00:00
cover cmd/cover: more clearly mark as deprecated 2020-05-22 20:15:01 +00:00
digraph all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
eg cmd/eg: Gofmt eg's dry-run output. 2017-07-13 04:09:46 +00:00
fiximports all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
getgo all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
go-contrib-init cmd/go-contrib-init: add unit test for the cmdErr function 2019-11-11 20:03:10 +00:00
godex all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
godoc cmd/godoc: support automatic vendoring 2020-06-09 06:04:08 +00:00
goimports all: rework goimports environment, support GOMODCACHE 2020-06-25 17:33:20 +00:00
gomvpkg cmd/gomvpkg: add missing closing double-quote to documentation 2018-05-22 18:16:25 +00:00
gorename all: consolidate cgo requirement checks 2020-05-18 17:24:58 +00:00
gotype all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
goyacc cmd/goyacc: put //line annotations on the first column. 2018-09-26 03:27:08 +00:00
guru all: do not write to testdata directories 2019-08-30 17:05:20 +00:00
html2article x/tools/cmd/html2article: remove unused functions 2017-03-01 14:53:04 +00:00
present all: run prettier on js and css 2020-05-28 15:31:44 +00:00
present2md present2md: fix depth count for blogs with sections 2020-03-17 20:55:21 +00:00
splitdwarf all: run go generate 2020-03-11 22:20:14 +00:00
ssadump go/ssa/ssautil: add AllPackages method 2018-10-15 18:41:29 +00:00
stress cmd/stress: use an ellipsis when truncating output 2020-01-22 22:00:14 +00:00
stringer cmd/stringer: remove redundant check in generated code 2020-01-14 01:55:19 +00:00
toolstash cmd/toolstash: don't try comparing "asm -V=full" output. 2017-11-02 22:54:56 +00:00