diff --git a/examples/basic/char b/examples/basic/char index 091909a..beed416 100755 Binary files a/examples/basic/char and b/examples/basic/char differ diff --git a/pkg/register/plugin.go b/pkg/register/plugin.go index 5a28a5a..85f5c16 100644 --- a/pkg/register/plugin.go +++ b/pkg/register/plugin.go @@ -11,3 +11,5 @@ type About struct { type Plugin interface { About(ctx context.Context) (*About, error) } + +const PluginKey = "plugin" diff --git a/pkg/register/plugin_builder.go b/pkg/register/plugin_builder.go index dcbcc38..40788ed 100644 --- a/pkg/register/plugin_builder.go +++ b/pkg/register/plugin_builder.go @@ -20,7 +20,7 @@ func NewPluginBuilder(p Plugin) *PluginBuilder { }) var pluginMap = map[string]plugin.Plugin{ - "plugin": &PluginAPI{ + PluginKey: &PluginAPI{ Impl: p, }, } diff --git a/pkg/register/plugin_register.go b/pkg/register/plugin_register.go index a00f888..11dd724 100644 --- a/pkg/register/plugin_register.go +++ b/pkg/register/plugin_register.go @@ -91,7 +91,7 @@ func (pr *PluginRegisterBuilder) Build(ctx context.Context) (*PluginRegister, er ), ), Plugins: map[string]plugin.Plugin{ - name: &p, + PluginKey: &p, }, }) @@ -175,8 +175,8 @@ func (pr *PluginRegister) About(ctx context.Context) ([]AboutItem, error) { errgroup, ctx := errgroup.WithContext(ctx) - for n, c := range pr.clients { - n, c := n, c + for _, c := range pr.clients { + c := c errgroup.Go(func() error { about, err := c.plugin.About(ctx) if err != nil { @@ -184,7 +184,7 @@ func (pr *PluginRegister) About(ctx context.Context) ([]AboutItem, error) { } list = append(list, AboutItem{ - Name: n, + Name: about.Name, Version: about.Version, About: about.About, })