Closed mpldr closed 3 years ago
You misunderstand how pointers (and pass-by-value) work. The caller of RPCCreate will not see its response modified. Try removing the assignment and see if the program behavior changes (it won't).
If you want to modify what response points to, then you need to write something like:
*response = *NewPermanent(req.Application, &req.Permissions, req.Expiration)
but that code kind of smells. More likely RPCCreate
should return the response.
Thank you very much. I didn't even notice that I missed dereferencing it.
but that code kind of smells. More likely RPCCreate should return the response.
I agree, would be more intuitive, but that's unfortunately not how net/rpc works.
This triggers an ineffectual assignment warning but it is not. The response is evaluated by the request sender.