MCPcopy
hub / github.com/helm/helm / LoadDir

Function LoadDir

internal/plugin/loader.go:143–160  ·  view source on GitHub ↗

LoadDir loads a plugin from the given directory.

(dirname string)

Source from the content-addressed store, hash-verified

141
142// LoadDir loads a plugin from the given directory.
143func LoadDir(dirname string) (Plugin, error) {
144 pluginfile := filepath.Join(dirname, PluginFileName)
145 metadataData, err := os.ReadFile(pluginfile)
146 if err != nil {
147 return nil, fmt.Errorf("failed to read plugin at %q: %w", pluginfile, err)
148 }
149
150 m, err := loadMetadata(metadataData)
151 if err != nil {
152 return nil, fmt.Errorf("failed to load plugin %q: %w", dirname, err)
153 }
154
155 pm, err := newPrototypePluginManager()
156 if err != nil {
157 return nil, fmt.Errorf("failed to create plugin manager: %w", err)
158 }
159 return pm.CreatePlugin(dirname, m)
160}
161
162func LogIgnorePluginLoadErrorFilterFunc(pluginYAML string, err error) error {
163 slog.Warn("failed to load plugin (ignoring)", slog.String("plugin_yaml", pluginYAML), slog.Any("error", err))

Callers 10

updatePluginFunction · 0.92
runMethod · 0.92
runMethod · 0.92
validatePluginNameFunction · 0.92
TestLoadDirFunction · 0.70
TestLoadDirGetterFunction · 0.70
TestPostRendererFunction · 0.70
LoadAllDirFunction · 0.70

Calls 3

loadMetadataFunction · 0.85
CreatePluginMethod · 0.65

Tested by 5

TestLoadDirFunction · 0.56
TestLoadDirGetterFunction · 0.56
TestPostRendererFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…