filecoin-project / filecoin-project/go-jsonrpc
Unmarshalling to an interface type?
- Dominant language
- Go
- Stars
- 100
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
It this supported? For example:
```go
// Package main implements a test JSON-RPC cli client
package main
import (
"context"
"flag"
"fmt"
"net"
"net/http"
"github.com/filecoin-project/go-jsonrpc"
"go.mills.io/saltyim"
)
func main() {
flag.Parse()
httpc := &http.Client{
Transport: &http.Transport{
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
return net.Dial("unix", flag.Arg(0))
},
},
}
var cli struct {
Me func() saltyim.Addr
String func() string
}
closer, err := jsonrpc.NewMergeClient(
context.Background(),
"http://example.com",
"Client",
[]any{&cli},
nil,
jsonrpc.WithHTTPClient(httpc),
)
if err != nil {
panic(err)
}
defer closer()
fmt.Printf("String():\n%s\n", cli.String())
me := cli.Me()
fmt.Printf("Me(): #%v\n", me)
}
```
Currently I get `nil` for a call to `cli.me()` 🤔
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.