1
0
mirror of https://github.com/golang/go synced 2024-11-22 07:04:40 -07:00

net/rpc: fix typo in documentation, clarify semantics of error return

Several of my students were confused by trying to use both the error
return and a reply return, so I figured it was worth explicitly clarifying
that returning an error overrides the reply.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6327051
This commit is contained in:
David G. Andersen 2012-06-22 15:07:22 -07:00 committed by Rob Pike
parent 75344d3d5b
commit e2f2929d85

View File

@ -24,12 +24,13 @@
where T, T1 and T2 can be marshaled by encoding/gob. where T, T1 and T2 can be marshaled by encoding/gob.
These requirements apply even if a different codec is used. These requirements apply even if a different codec is used.
(In future, these requirements may soften for custom codecs.) (In the future, these requirements may soften for custom codecs.)
The method's first argument represents the arguments provided by the caller; the The method's first argument represents the arguments provided by the caller; the
second argument represents the result parameters to be returned to the caller. second argument represents the result parameters to be returned to the caller.
The method's return value, if non-nil, is passed back as a string that the client The method's return value, if non-nil, is passed back as a string that the client
sees as if created by errors.New. sees as if created by errors.New. If an error is returned, the reply parameter
will not be sent back to the client.
The server may handle requests on a single connection by calling ServeConn. More The server may handle requests on a single connection by calling ServeConn. More
typically it will create a network listener and call Accept or, for an HTTP typically it will create a network listener and call Accept or, for an HTTP