From ea93d6de450c5d5bed11ced23feb8f3bd639809c Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 5 Nov 2022 23:11:08 +0100 Subject: [PATCH] with any instead --- pkg/register/plugin_server.go | 10 ++++++++-- plugins/gocli/main.go | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/register/plugin_server.go b/pkg/register/plugin_server.go index 0e7a630..3c86d5c 100644 --- a/pkg/register/plugin_server.go +++ b/pkg/register/plugin_server.go @@ -3,15 +3,21 @@ package register import ( "context" "encoding/json" + "errors" ) type PluginServer struct { Impl Plugin } -func (ps *PluginServer) Do(args string, resp *string) error { +func (ps *PluginServer) Do(args any, resp *string) error { + rawReq, ok := args.(string) + if !ok { + return errors.New("args is not a string") + } + var doReq DoRequest - if err := json.Unmarshal([]byte(args), &doReq); err != nil { + if err := json.Unmarshal([]byte(rawReq), &doReq); err != nil { return err } diff --git a/plugins/gocli/main.go b/plugins/gocli/main.go index 57b60d0..29b1126 100644 --- a/plugins/gocli/main.go +++ b/plugins/gocli/main.go @@ -12,7 +12,6 @@ type GoCliPlugin struct{} // Do implements register.Plugin func (*GoCliPlugin) Do(ctx context.Context, commandName string, args map[string]string) error { log.Print("hit do") - return nil }