Followup go/vcs FromDir change CL to cmd/go/vcs.go.
dmitshur opened this issue · comments
The relevant change in go/vcs is golang/tools@5804fef.
In it, I said:
Import path is a '/'-separated path.
However, I didn't back that up with any sources, because it was hard to find something concrete, and I was hoping it'd be accepted via common knowledge. At least it should be enough for the golang.org/x/tools/go/vcs
package. It was, and the change was reviewed with +2 in https://golang.org/cl/18461 and merged, resolving golang/go#7723.
I want to follow up that change and apply it to the very similar source in cmd/go/vcs.go file (in cmd/go
command) where vcs.FromDir
was originally copied from.
Motivation to do that:
- Keep the two pieces of code in sync, so it's easier to apply bug fixes to them in future, if any.
- Backport some fixes/improvements done to the
x/tools/go/vcs
version intocmd/go
.
I want to find some more definitive sources on what constitutes as an "import path" in the context of cmd/go
build tool. The best sources, so far, seem to be:
go help importpath
go help packages
The build tool seems to expect schema-less URIs (or relative paths), which would dictate the forward slash. It says that ./
and ../
denote a relative path. For remote paths, it's implied by the examples and hint, that they're URIs.
The Go spec has less strict restrictions, as described at https://golang.org/ref/spec#Import_declarations. But we're interested in the definition of "import path" in the context of cmd/go
only.
Thanks to @lramirez and @dominikh for help compiling the above.
- Before I do the above, I'll apply golang/go@b99fdb2 to
golang.org/x/tools/go/vcs
.- Done in https://golang.org/cl/21342.
Also, this entire issue is very related to golang/go#11490.
Created https://golang.org/cl/21345, awaiting review.
It's been reviewed, need to follow up next.
Also made https://golang.org/cl/21795, and they're both merged! Woohoo!