I have read go rpc documentation, and find out one of the 4 criteria:
the method's second argument is a pointer.
The method below shows the right way to use go rpc, thus the second parameter is a pointer *T2.
func (t *T) MethodName(argType T1, replyType *T2) error
Is there any reason for this criteria? Why should it be a pointer?
After I read more examples, find that for most of time, even the first argument is a pointer!
func (t *Arith) Multiply(args *Args, reply *int) error {
*reply = args.A * args.B
return nil
}
I know the difference between pointer type and common type, but I'm not sure about it in rpc context.