diff --git a/cli-plugins/manager/manager.go b/cli-plugins/manager/manager.go index ef4b489606d3..94980b5fcbad 100644 --- a/cli-plugins/manager/manager.go +++ b/cli-plugins/manager/manager.go @@ -75,12 +75,12 @@ func getPluginDirs(cfg *configfile.ConfigFile) ([]string, error) { return pluginDirs, nil } -func addPluginCandidatesFromDir(res map[string][]string, d string) error { +func addPluginCandidatesFromDir(res map[string][]string, d string) { dentries, err := os.ReadDir(d) // Silently ignore any directories which we cannot list (e.g. due to // permissions or anything else) or which is not a directory if err != nil { - return nil + return } for _, dentry := range dentries { switch dentry.Type() & os.ModeType { @@ -101,20 +101,13 @@ func addPluginCandidatesFromDir(res map[string][]string, d string) error { } res[name] = append(res[name], filepath.Join(d, dentry.Name())) } - return nil } // listPluginCandidates returns a map from plugin name to the list of (unvalidated) Candidates. The list is in descending order of priority. func listPluginCandidates(dirs []string) (map[string][]string, error) { result := make(map[string][]string) for _, d := range dirs { - if err := addPluginCandidatesFromDir(result, d); err != nil { - // Silently ignore paths which don't exist. - if os.IsNotExist(err) { - continue - } - return nil, err // Or return partial result? - } + addPluginCandidatesFromDir(result, d) } return result, nil }