Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/rpc: give hint to pass a pointer to Register #4325

Closed
kisielk opened this issue Oct 31, 2012 · 2 comments
Closed

net/rpc: give hint to pass a pointer to Register #4325

kisielk opened this issue Oct 31, 2012 · 2 comments
Milestone

Comments

@kisielk
Copy link
Contributor

kisielk commented Oct 31, 2012

Currently it can be quite difficult to track down some errors when misusing rpc.Register

Here's an extremely contrived example:

http://play.golang.org/p/DFgesPZmkV

changing the Register line to rpc.Register(&t) makes the code work because the
methods are defined on a pointer instead of a value receiver. Since according to the
net/rpc documentation the methods must have a pointer receiver I think the Register
function could provide a more informative message in this case. The current error
message "no exported methods of suitable type" implies there is something
wrong with the methods themselves whereas the real problem is the way the type is being
registered with the Register function.
@minux
Copy link
Member

minux commented Nov 3, 2012

Comment 1:

http://golang.org/cl/6819081

Labels changed: added priority-later, removed priority-triage.

Owner changed to @minux.

Status changed to Started.

@minux
Copy link
Member

minux commented Nov 6, 2012

Comment 2:

This issue was closed by revision 0e3f4fd.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants