Plugins: Move discovery logic to plugin sources (#106911)

* move finder behaviour to source

* tidy

* undo go.mod changes

* fix comment

* tidy unsafe local source
This commit is contained in:
Will Browne
2025-06-19 10:28:23 +01:00
committed by GitHub
parent 2b21bdf4e1
commit 3d37f969e7
23 changed files with 475 additions and 917 deletions
+5 -5
View File
@@ -480,7 +480,7 @@ func (s *FakeSourceRegistry) List(ctx context.Context) []plugins.PluginSource {
type FakePluginSource struct {
PluginClassFunc func(ctx context.Context) plugins.Class
PluginURIsFunc func(ctx context.Context) []string
DiscoverFunc func(ctx context.Context) ([]*plugins.FoundBundle, error)
DefaultSignatureFunc func(ctx context.Context) (plugins.Signature, bool)
}
@@ -491,11 +491,11 @@ func (s *FakePluginSource) PluginClass(ctx context.Context) plugins.Class {
return ""
}
func (s *FakePluginSource) PluginURIs(ctx context.Context) []string {
if s.PluginURIsFunc != nil {
return s.PluginURIsFunc(ctx)
func (s *FakePluginSource) Discover(ctx context.Context) ([]*plugins.FoundBundle, error) {
if s.DiscoverFunc != nil {
return s.DiscoverFunc(ctx)
}
return []string{}
return []*plugins.FoundBundle{}, nil
}
func (s *FakePluginSource) DefaultSignature(ctx context.Context, _ string) (plugins.Signature, bool) {