FindPlugin returns a single plugin that matches the descriptor
(dirs []string, descriptor Descriptor)
| 254 | |
| 255 | // FindPlugin returns a single plugin that matches the descriptor |
| 256 | func FindPlugin(dirs []string, descriptor Descriptor) (Plugin, error) { |
| 257 | loadAllIgnoreErrors := func(pluginsDir string) ([]Plugin, error) { |
| 258 | return LoadAllDir(pluginsDir, LogIgnorePluginLoadErrorFilterFunc) |
| 259 | } |
| 260 | |
| 261 | plugins, err := findPlugins(dirs, loadAllIgnoreErrors, makeDescriptorFilter(descriptor)) |
| 262 | if err != nil { |
| 263 | return nil, err |
| 264 | } |
| 265 | |
| 266 | if len(plugins) > 0 { |
| 267 | return plugins[0], nil |
| 268 | } |
| 269 | |
| 270 | return nil, fmt.Errorf("plugin: %+v not found", descriptor) |
| 271 | } |
| 272 | |
| 273 | func detectDuplicates(plugs []Plugin) error { |
| 274 | names := map[string]string{} |
no test coverage detected
searching dependent graphs…