hashicorp / hashicorp/go-plugin
Use of interfaces
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 511
- Avg merge
- 22h 47m
- Merged PRs (30d)
- 4
Description
Hi,
I am migrating Go plugins to this library because there are too many drawbacks using the standard library.
Is it possible for functions of interfaces to return another interface living in the same plugin? If so, how does the common RPC client look like?
How can I pass several args down to the plugin?
I have a common interface like this:
```go
type Example interface {
InternalOtherInterface(arg1 string, arg2 string) InternalOtherInterface
}
```
Using the RPC client I usually write something like this (when not returning interface):
```go
func (p *PluginClient) InternalOtherInterface() InternalOtherInterface {
var oa OtherInterface
err := p.client.Call("Plugin.InternalOtherInterface", new(interface{}), &oa)
if err != nil {
///
}
///
return oa
}
```
The error provoking the panic is the following:
```bash
rpc: gob error encoding body: gob: type not registered for interface: main.internalotherinterface
```
Thank you for your time.
EDIT: Add question about args.
Contributor guide
Assessment
This issue has not been assessed yet.