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

rpc module tries to register private methods #1056

Closed
msolo opened this issue Aug 29, 2010 · 1 comment
Closed

rpc module tries to register private methods #1056

msolo opened this issue Aug 29, 2010 · 1 comment

Comments

@msolo
Copy link
Contributor

msolo commented Aug 29, 2010

What steps will reproduce the problem?
1. create a private method on a service class, like this:

func (service *UmgmtService) closeListeners() (err os.Error) {
...
}

2. register your service, start your app and see:

2010/08/29 00:57:42 method closeListeners has wrong number of ins: 1

What is the expected output?

I would expect no message at all.


This patch should fix it:

diff -r 1fc1447ebedf src/pkg/rpc/server.go
--- a/src/pkg/rpc/server.go Sat Aug 28 07:54:16 2010 +1000
+++ b/src/pkg/rpc/server.go Sun Aug 29 00:54:21 2010 -0700
@@ -211,7 +211,7 @@
        method := s.typ.Method(m)
        mtype := method.Type
        mname := method.Name
-       if mtype.PkgPath() != "" && !isPublic(mname) {
+       if mtype.PkgPath() != "" || !isPublic(mname) {
            continue
        }
        // Method needs three ins: receiver, *args, *reply.
@robpike
Copy link
Contributor

robpike commented Aug 29, 2010

Comment 1:

This issue was closed by revision 64cb9b6.

Status changed to Fixed.

@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

3 participants