fix: import non-existant package
This commit is contained in:
@@ -191,7 +191,8 @@ func effectivePkg(root, path string) string {
|
||||
for i := 0; i < len(splitPath); i++ {
|
||||
part := splitPath[len(splitPath)-1-i]
|
||||
|
||||
if part == splitRoot[len(splitRoot)-1-rootIndex] && i != 0 {
|
||||
index := len(splitRoot) - 1 - rootIndex
|
||||
if index > 0 && part == splitRoot[index] && i != 0 {
|
||||
prevRootIndex = rootIndex
|
||||
rootIndex++
|
||||
} else if prevRootIndex == rootIndex {
|
||||
|
||||
@@ -26,6 +26,12 @@ func Test_effectivePkg(t *testing.T) {
|
||||
path: "vendor/guthib.com/containous/vin",
|
||||
expected: "github.com/foo/plugin/vendor/guthib.com/containous/fromage/vendor/guthib.com/containous/vin",
|
||||
},
|
||||
{
|
||||
desc: "path is non-existent",
|
||||
root: "foo",
|
||||
path: "githib.com/foo/app",
|
||||
expected: "foo/githib.com/foo/app",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user