1
0
mirror of https://github.com/golang/go synced 2024-11-19 00:34:40 -07:00
go/go/vcs
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
..
discovery.go go/vcs: workaround EOF bug in token-based XML decoder 2015-12-29 20:27:04 +00:00
env.go go.tools: add go/vcs 2013-08-15 09:00:02 -07:00
http.go go.tools: add go/vcs 2013-08-15 09:00:02 -07:00
vcs_test.go x/tools/go/vcs: fix FromDir returning bad root on Windows 2016-01-19 15:45:24 +00:00
vcs.go x/tools/go/vcs: fix FromDir returning bad root on Windows 2016-01-19 15:45:24 +00:00