MCPcopy
hub / github.com/vmware-tanzu/sonobuoy / findPlugins

Function findPlugins

pkg/plugin/loader/loader.go:90–107  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

88}
89
90func findPlugins(dir string) ([]string, error) {
91 candidates, err := os.ReadDir(dir)
92 if err != nil {
93 return []string{}, errors.Wrapf(err, "couldn't search path %v", dir)
94 }
95
96 plugins := []string{}
97 for _, candidate := range candidates {
98 if candidate.IsDir() {
99 continue
100 }
101 ext := filepath.Ext(candidate.Name())
102 if ext == ".yml" || ext == ".yaml" {
103 plugins = append(plugins, filepath.Join(dir, candidate.Name()))
104 }
105 }
106 return plugins, nil
107}
108
109func LoadDefinitionFromFile(file string) (*manifest.Manifest, error) {
110 definitionFile, err := readDefinitionFromFile(file)

Callers 2

TestFindPluginsFunction · 0.85
LoadAllPluginsFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by 1

TestFindPluginsFunction · 0.68