Skip to content

Commit 137b456

Browse files
facchinmcmaglie
authored andcommitted
allow tools with same name and different vendor
1 parent cb1d520 commit 137b456

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools_loader.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ func collectAllToolsFolders(from string) ([]string, error) {
121121
return folders, i18n.WrapError(err)
122122
}
123123

124-
func toolsSliceContains(tools *[]*types.Tool, name, version string) bool {
124+
func toolsSliceContains(tools *[]*types.Tool, name, version string, vendor string) bool {
125125
for _, tool := range *tools {
126-
if name == tool.Name && version == tool.Version {
126+
if name == tool.Name && version == tool.Version && vendor == tool.Vendor {
127127
return true
128128
}
129129
}
@@ -148,7 +148,7 @@ func loadToolsFrom(tools *[]*types.Tool, builtinToolsVersionsFilePath string) er
148148
toolName := strings.Split(rowParts[0], ".")[1]
149149
toolVendor := strings.Split(rowParts[0], ".")[0]
150150
toolVersion := rowParts[1]
151-
if !toolsSliceContains(tools, toolName, toolVersion) {
151+
if !toolsSliceContains(tools, toolName, toolVersion, toolVendor) {
152152
*tools = append(*tools, &types.Tool{Name: toolName, Vendor: toolVendor, Version: toolVersion, Folder: folder})
153153
}
154154
}
@@ -192,7 +192,7 @@ func loadToolsFromFolderStructure(tools *[]*types.Tool, folder string) error {
192192
return i18n.WrapError(err)
193193
}
194194
toolVendor := filepath.Base(strings.Replace(folder, filepath.Base(folder), "", -1))
195-
if !toolsSliceContains(tools, toolName.Name(), toolVersion.Name()) {
195+
if !toolsSliceContains(tools, toolName.Name(), toolVersion.Name(), toolVendor) {
196196
*tools = append(*tools, &types.Tool{Name: toolName.Name(), Vendor: toolVendor, Version: toolVersion.Name(), Folder: toolFolder})
197197
}
198198
}

0 commit comments

Comments
 (0)