From b4eb15faf1326f2af2317ef7be1a9c76cf60fe1d Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Sat, 30 Sep 2017 06:32:34 +0700 Subject: [PATCH] Ignore sub-vendor package --- src/goPackages.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/goPackages.ts b/src/goPackages.ts index ad532e58e..246770d1d 100644 --- a/src/goPackages.ts +++ b/src/goPackages.ts @@ -140,14 +140,15 @@ function getRelativePackagePath(currentFileDirPath: string, currentWorkspace: st vendorIndex = 0; } } - // Check if current file and the vendor pkg belong to the same root project + // Check if current file and the vendor pkg belong to the same root project and not sub vendor // If yes, then vendor pkg can be replaced with its relative path to the "vendor" folder // If not, then the vendor pkg should not be allowed to be imported. if (vendorIndex > -1) { let rootProjectForVendorPkg = path.join(currentWorkspace, pkgPath.substr(0, vendorIndex)); let relativePathForVendorPkg = pkgPath.substring(vendorIndex + magicVendorString.length); + let subVendor = relativePathForVendorPkg.indexOf('/vendor/') !== -1; - if (relativePathForVendorPkg && currentFileDirPath.startsWith(rootProjectForVendorPkg)) { + if (relativePathForVendorPkg && currentFileDirPath.startsWith(rootProjectForVendorPkg) && !subVendor) { return relativePathForVendorPkg; } return '';