1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:44:46 -07:00

imports: export VendorlessPath

Rename to avoid imports/import stutter and export.
It will be used soon by guru's referrers command.

This work supported by Sourcegraph.

Change-Id: Ibfc39d061d6269a336a59d9b6979188a94537d94
Reviewed-on: https://go-review.googlesource.com/108877
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Josh Bleecher Snyder 2018-04-23 09:37:30 -07:00
parent 71f44073ef
commit 81527693ec

View File

@ -638,7 +638,7 @@ func scanGoDirs(goRoot bool) {
importpath := filepath.ToSlash(dir[len(srcDir)+len("/"):])
dirScan[dir] = &pkg{
importPath: importpath,
importPathShort: vendorlessImportPath(importpath),
importPathShort: VendorlessPath(importpath),
dir: dir,
}
}
@ -683,9 +683,9 @@ func scanGoDirs(goRoot bool) {
}
}
// vendorlessImportPath returns the devendorized version of the provided import path.
// VendorlessPath returns the devendorized version of the provided import path.
// e.g. "foo/bar/vendor/a/b" => "a/b"
func vendorlessImportPath(ipath string) string {
func VendorlessPath(ipath string) string {
// Devendorize for use in import statement.
if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 {
return ipath[i+len("/vendor/"):]