RPC를 통해 구체적인 구현을 보내려고합니다. RPC 메소드는 인터페이스를 필요로합니다.인터페이스에 이름이 등록되지 않았습니다.
관련 코드 조각은 다음과 같습니다
패키지 node
에서 :
type Commander interface {
Action() string
}
type Approach struct {
Position int
}
func (p Approach) Action() string {
return "Approach"
}
func (t *RPCMethod) RPCAction(command Commander, reply *int) error {
// RPC Method
}
패키지 main
에서 :
import "node"
gob.Register(node.Approach{})
var p = node.Approach{position}
var q node.Commander = p
var reply int
err = client.Call("RPCMethod.RPCAction",&q, &reply)
가 나는 덩어리로 node.Approach을 등록했다. 그러나 내가받는 주 프로그램을 실행 중
gob: name not registered for interface: "node.Approach"
내가 뭘 잘못하고 있는지에 대한 아이디어가 있습니까? 또는 이름을 등록하는 방법?