go的rpc出现提示:method Xxx has wrong number of ins: 1
2014-12-02 22:52
281 查看
the way to go的$19.8和$19.9里面的demo:goto_5
$go version
go version go1.1.2 darwin/amd64
$./goto_v5 -http=:8081 -rpc=true //启动master的时候,会显示下面一行提示:
2014/12/02 22:36:29 method Count has wrong number of ins: 1
出现这个提示的原因是:
1.RPC can only work through methods with the form (t is a value of type T):
2.Count()这个函数本来是私有的,但是错误的public了。而且函数的参数和返回类型跟RPC能处理的Public函数要求不一致。
goto_v1~goto_v4这4个版本没有加rpc的时候,没问题。
goto_v5用了rpc,就把这个问题暴露出来了。
解决办法:
把这两个地方的Count改成count,重新编译,运行就ok了!
参考: https://code.google.com/p/go/issues/detail?id=1056
$go version
go version go1.1.2 darwin/amd64
$./goto_v5 -http=:8081 -rpc=true //启动master的时候,会显示下面一行提示:
2014/12/02 22:36:29 method Count has wrong number of ins: 1
func (s *URLStore) Put(url, key *string) error { for { *key = genKey(s.Count()) if err := s.Set(key, url); err == nil { break } } if s.save != nil { s.save <- record{*key, *url} } return nil } func (s *URLStore) Count() int { s.mu.RLock() defer s.mu.RUnlock() return len(s.urls) }
出现这个提示的原因是:
1.RPC can only work through methods with the form (t is a value of type T):
func (t T) Name(args *ArgType, reply *ReplyType) error
2.Count()这个函数本来是私有的,但是错误的public了。而且函数的参数和返回类型跟RPC能处理的Public函数要求不一致。
goto_v1~goto_v4这4个版本没有加rpc的时候,没问题。
goto_v5用了rpc,就把这个问题暴露出来了。
解决办法:
把这两个地方的Count改成count,重新编译,运行就ok了!
参考: https://code.google.com/p/go/issues/detail?id=1056
相关文章推荐
- 用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载 、一直返回error
- iOS开发中,提示信息The maximum number of apps for free development profiles has been reached
- Oracle Grid 11.2.0.4 安装是出现"INS-30510: Insufficient number of ASM disks selected."
- newInstance传入String 数组 提示Wrong number of arguments
- 出现 com.caucho.hessian.io.HessianServiceException: The service has no method named: XXX 异常的原因及解决方法
- 安装orace grid infrastructure 提示“[INS-40404] The installer has detected a configured instance of ..
- eclipse编译器出现Type Class 'XXX' has virtual method 'XXX' but non-virtual destructor的解决办法
- 使用spring注入时出现 XXX is not writable or has an invalid setter method
- terminal server has exceeded max number of allowed connections(如何避免出现“终端服务器超出了最大允许连接数”)
- The number of method references in xxx.dex file cannot exceed 64K问题
- Java重写父类使用@Override时出现The method destroy() of type xxx must override a superclass method的问题解决
- [置顶] Genymotion 出现the number of cpus of the virtual device has been forced to be 1的解决方法
- Caused by: org.hibernate.MappingException: collection foreign key mapping has wrong number of column
- 用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载
- a confused method--forXXXTimeOfDayXXX
- 关于运行msdn 2001时出现“打不开MSDNxxx.COL”的提示与搜索项无显示
- 原创:Java反射中java.lang.IllegalArgumentException: wrong number of arguments异常
- ERROR The terminal server has exceeded the maximum number of allowed connections
- We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
- Maven出现以下问题:The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using ja