makeDescriptorFilter creates a filter function from a descriptor Additional plugin filter criteria we wish to support can be added here
(descriptor Descriptor)
| 238 | // makeDescriptorFilter creates a filter function from a descriptor |
| 239 | // Additional plugin filter criteria we wish to support can be added here |
| 240 | func makeDescriptorFilter(descriptor Descriptor) filterFunc { |
| 241 | return func(p Plugin) bool { |
| 242 | // If name is specified, it must match |
| 243 | if descriptor.Name != "" && p.Metadata().Name != descriptor.Name { |
| 244 | return false |
| 245 | |
| 246 | } |
| 247 | // If type is specified, it must match |
| 248 | if descriptor.Type != "" && p.Metadata().Type != descriptor.Type { |
| 249 | return false |
| 250 | } |
| 251 | return true |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | // FindPlugin returns a single plugin that matches the descriptor |
| 256 | func FindPlugin(dirs []string, descriptor Descriptor) (Plugin, error) { |
no test coverage detected
searching dependent graphs…