@@ -171,22 +171,11 @@ func (t *Tools) Download(name, version, behaviour string) error {
171
171
t .Logger .Println (string (body ))
172
172
173
173
// Find the tool by name
174
- correctTool := findTool (name , version , data )
174
+ correctTool , correctSystem := findTool (name , version , data )
175
175
176
- if correctTool .Name == "" {
177
- return errors .New ("We couldn't find a tool with the name " + name + " and version " + version )
178
- }
179
-
180
- // Find the url based on system
181
- var correctSystem system
182
- max_similarity := 0.8
183
-
184
- for _ , s := range correctTool .Systems {
185
- similarity := smetrics .Jaro (s .Host , systems [runtime .GOOS + runtime .GOARCH ])
186
- if similarity > max_similarity {
187
- correctSystem = s
188
- max_similarity = similarity
189
- }
176
+ if correctTool .Name == "" || correctSystem .URL == "" {
177
+ t .Logger .Println ("We couldn't find a tool with the name " + name + " and version " + version )
178
+ return nil
190
179
}
191
180
192
181
key := correctTool .Name + "-" + correctTool .Version
@@ -265,7 +254,7 @@ func (t *Tools) Download(name, version, behaviour string) error {
265
254
return t .writeMap ()
266
255
}
267
256
268
- func findTool (name , version string , data index ) tool {
257
+ func findTool (name , version string , data index ) ( tool , system ) {
269
258
var correctTool tool
270
259
correctTool .Version = "0.0"
271
260
@@ -285,7 +274,20 @@ func findTool(name, version string, data index) tool {
285
274
}
286
275
}
287
276
}
288
- return correctTool
277
+
278
+ // Find the url based on system
279
+ var correctSystem system
280
+ max_similarity := 0.8
281
+
282
+ for _ , s := range correctTool .Systems {
283
+ similarity := smetrics .Jaro (s .Host , systems [runtime .GOOS + runtime .GOARCH ])
284
+ if similarity > max_similarity {
285
+ correctSystem = s
286
+ max_similarity = similarity
287
+ }
288
+ }
289
+
290
+ return correctTool , correctSystem
289
291
}
290
292
291
293
func stringInSlice (str string , list []string ) bool {
0 commit comments