tools/go
Dmitri Shuralyov 5804fef4c0 x/tools/go/vcs: fix FromDir returning bad root on Windows
Import path is a '/'-separated path. FromDir documentation says
on return, root is the import path corresponding to the root of
the repository. On Windows and other OSes where os.PathSeparator
is not '/', that wasn't true since root would contain characters
other than '/', and therefore it wasn't a valid import path
corresponding to the root of the repository. Fix that by using
filepath.ToSlash.

Add test coverage for root value returned from FromDir, it was
previously not tested.

Additionally, remove a dubious statement from the documentation
"(thus root is a prefix of importPath)". There is no variable
importPath that is being referred to. It's also redundant and
confusing. Without it, the description of root value matches
the documentation of RepoRoot.Root struct field:

	// Root is the import path corresponding to the root of the
	// repository.
	Root string

Fixes golang/go#7723.

Change-Id: If9f5f55b5751e01a7f88b79d9b039402af3e9312
Reviewed-on: https://go-review.googlesource.com/18461
Reviewed-by: Chris Manghane <cmang@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-19 15:45:24 +00:00
..
ast/astutil go/ast/astutil: set Pos for import name 2015-05-19 23:10:16 +00:00
buildutil tools: fallout from flipped sense of build.IgnoreVendor flag 2016-01-08 18:54:48 +00:00
callgraph tools: switch to standard go/types at tip 2016-01-06 22:15:26 +00:00
exact tools: add import comments. 2014-12-09 22:42:16 +00:00
gccgoimporter x/tools: disable tests not supported on Android 2015-08-06 00:36:03 +00:00
gcimporter go/types: change {Type,Object,Selection}String to accept a Qualifier function 2015-06-30 19:00:00 +00:00
gcimporter15 go/gcimporter15: a copy of go/gcimporter using go1.5 std go/types 2016-01-07 18:06:54 +00:00
importer go/importer: in TestImportStdLib, skip 2 packages that use vendoring 2015-12-28 21:28:10 +00:00
loader go/loader: reduce contention for findPackage mutex 2016-01-13 18:09:25 +00:00
pointer tools: switch to standard go/types at tip 2016-01-06 22:15:26 +00:00
ssa tools: switch to standard go/types at tip 2016-01-06 22:15:26 +00:00
types go/types: fix a comment of Named.Obj 2016-01-16 17:31:34 +00:00
vcs x/tools/go/vcs: fix FromDir returning bad root on Windows 2016-01-19 15:45:24 +00:00