tools/cmd
Russ Cox bf084ef758 imports: add support for vendor directories
Editor modes that invoke the goimports command on temporary copies
of actual source files will need to invoke goimports -srcdir now to say
where the real source directory is. Otherwise goimports will not consider
vendored or internal packages when looking for new imports.

In lieu of a test for cmd/goimports (because it has no tests),
a command transcript:

	$ cd /tmp
	$ cat x.go
	package p
	var _ = hpack.HuffmanDecode
	$

	$ GOPATH= goimports < x.go
	package p

	var _ = hpack.HuffmanDecode
	$ GOPATH= goimports x.go
	package p

	var _ = hpack.HuffmanDecode
	$

But with the new flag:

	$ GOPATH= goimports -srcdir $GOROOT/src/math < x.go
	package p

	import "golang.org/x/net/http2/hpack"

	var _ = hpack.HuffmanDecode
	$ GOPATH= goimports -srcdir $GOROOT/src/math x.go
	package p

	import "golang.org/x/net/http2/hpack"

	var _ = hpack.HuffmanDecode
	$

The tests in this CL and the above transcript assume that
$GOROOT/src/vendor/golang.org/x/net/http2/hpack exists.
It did in 40a26c9, but it does not today.
It will again soon (once Go 1.7 opens).

For golang/go#12278 (original request).

Change-Id: I27b136041f54edcde4bf474215b48ebb0417f34d
Reviewed-on: https://go-review.googlesource.com/17728
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-18 16:47:46 +00:00
..
benchcmp benchmark/parser, cmd/benchcmp: improve names of exported identifiers 2015-01-15 01:28:17 +00:00
bundle bundle: new docs, command-line interface 2016-02-17 15:40:24 +00:00
callgraph x/tools/cmd/callgraph: add -ptalog flag 2015-12-04 17:49:28 +00:00
cover x/tools: disable tests not supported on Android 2015-08-06 00:36:03 +00:00
digraph tools: add import comments. 2014-12-09 22:42:16 +00:00
eg refactor/eg: refactor to break dependency on go/loader 2015-09-01 14:26:06 +00:00
fiximports cmd/fiximports: -replace flag specifies canonical packages in absence of import comments 2015-09-01 14:23:39 +00:00
godex x/tools/cmd/godex: prepare sources for switch to 1.5 go/types 2015-10-09 20:47:08 +00:00
godoc cmd/godoc: accept GOOS and GOARCH URL parameters in -http mode 2016-02-04 22:11:53 +00:00
goimports imports: add support for vendor directories 2016-02-18 16:47:46 +00:00
gomvpkg go/buildutil: TagsFlag provides a flag.Value for setting build.Context.BuildTags from -tags flag. 2015-04-23 14:10:21 +00:00
gorename cmd/gorename: -d flag prints diffs instead of rewriting files 2015-12-30 15:25:00 +00:00
gotype cmd/gotype: keep gotype working with Go1.4 2015-08-25 03:53:50 +00:00
guru cmd/guru: fix build breakage due to unneeded log import 2016-02-16 02:42:20 +00:00
html2article all: address vet reports 2014-12-29 06:08:34 +00:00
oracle cmd/oracle: add pointsto, whicherrs to help message 2016-02-11 22:30:21 +00:00
present x/tools/present: add video element for slides 2016-01-13 03:34:37 +00:00
ssadump tools: switch to standard go/types at tip 2016-01-06 22:15:26 +00:00
stress all: fix plan9 failures 2016-01-28 00:31:03 +00:00
stringer cmd/stringer: fork and tag for go1.4 2016-01-11 14:24:22 +00:00
tip cmd/tip: update deploy instructions 2016-01-27 02:50:12 +00:00
vet cmd/vet: roll back update of go/types import 2016-01-07 20:27:05 +00:00