@@ -1073,8 +1073,6 @@ func getCommonParentsWorker(componentGroups [][]string, minComponents int, optio
1073
1073
}
1074
1074
1075
1075
equality := options .getEqualityComparer ()
1076
- var lastCommonIndex int
1077
- outer:
1078
1076
for lastCommonIndex := range maxDepth {
1079
1077
candidate := componentGroups [0 ][lastCommonIndex ]
1080
1078
for j , comps := range componentGroups [1 :] {
@@ -1095,25 +1093,25 @@ outer:
1095
1093
head []string
1096
1094
tails [][]string
1097
1095
}{
1098
- head : g [:lastCommonIndex ],
1099
- tails : append (newGroups [key ].tails , g [lastCommonIndex :]),
1096
+ head : g [:lastCommonIndex + 1 ],
1097
+ tails : append (newGroups [key ].tails , g [lastCommonIndex + 1 :]),
1100
1098
}
1101
1099
}
1102
1100
slices .Sort (orderedGroups )
1103
1101
result := make ([][]string , 0 , len (newGroups ))
1104
1102
for _ , key := range orderedGroups {
1105
1103
group := newGroups [key ]
1106
- subResults := getCommonParentsWorker (group .tails , minComponents - lastCommonIndex , options )
1104
+ subResults := getCommonParentsWorker (group .tails , minComponents - ( lastCommonIndex + 1 ) , options )
1107
1105
for _ , sr := range subResults {
1108
1106
result = append (result , append (group .head , sr ... ))
1109
1107
}
1110
1108
}
1111
1109
return result
1112
1110
}
1113
- break outer
1111
+ return [][] string { componentGroups [ 0 ][: lastCommonIndex ]}
1114
1112
}
1115
1113
}
1116
1114
}
1117
1115
1118
- return [][]string {componentGroups [0 ][:lastCommonIndex ]}
1116
+ return [][]string {componentGroups [0 ][:maxDepth ]}
1119
1117
}
0 commit comments