with any instead
This commit is contained in:
parent
e34aa4134e
commit
ea93d6de45
@ -3,15 +3,21 @@ package register
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PluginServer struct {
|
type PluginServer struct {
|
||||||
Impl Plugin
|
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
|
var doReq DoRequest
|
||||||
if err := json.Unmarshal([]byte(args), &doReq); err != nil {
|
if err := json.Unmarshal([]byte(rawReq), &doReq); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ type GoCliPlugin struct{}
|
|||||||
// Do implements register.Plugin
|
// Do implements register.Plugin
|
||||||
func (*GoCliPlugin) Do(ctx context.Context, commandName string, args map[string]string) error {
|
func (*GoCliPlugin) Do(ctx context.Context, commandName string, args map[string]string) error {
|
||||||
log.Print("hit do")
|
log.Print("hit do")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user