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:
parent
71f44073ef
commit
81527693ec
|
@ -638,7 +638,7 @@ func scanGoDirs(goRoot bool) {
|
||||||
importpath := filepath.ToSlash(dir[len(srcDir)+len("/"):])
|
importpath := filepath.ToSlash(dir[len(srcDir)+len("/"):])
|
||||||
dirScan[dir] = &pkg{
|
dirScan[dir] = &pkg{
|
||||||
importPath: importpath,
|
importPath: importpath,
|
||||||
importPathShort: vendorlessImportPath(importpath),
|
importPathShort: VendorlessPath(importpath),
|
||||||
dir: dir,
|
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"
|
// 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.
|
// Devendorize for use in import statement.
|
||||||
if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 {
|
if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 {
|
||||||
return ipath[i+len("/vendor/"):]
|
return ipath[i+len("/vendor/"):]
|
||||||
|
|
Loading…
Reference in New Issue