with any instead

This commit is contained in:
2022-11-05 23:11:08 +01:00
parent e34aa4134e
commit ea93d6de45
2 changed files with 8 additions and 3 deletions

View File

@@ -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
}