go的rpc出现提示:method Xxx has wrong number of ins: 1
来源:互联网 发布:弱覆盖优化 编辑:程序博客网 时间:2024/05/14 03:26
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: 1func (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
0 0
- go的rpc出现提示:method Xxx has wrong number of ins: 1
- openCL: Call has wrong number of parameters
- eclipse编译器出现Type Class 'XXX' has virtual method 'XXX' but non-virtual destructor的解决办法
- newInstance传入String 数组 提示Wrong number of arguments
- wrong number of arguments (1 for 2)
- wrong number of arguments
- 使用CooCox的CoIDE打开mbed项目失败:提示 The chip:STM32F103RB information of current project has sonething wrong
- 使用CooCox的CoIDE打开mbed项目失败:提示 The chip:STM32F103RB information of current project has sonething wrong
- Genymotion 出现the number of cpus of the virtual device has been forced to be 1的解决方法
- 用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载
- 安装orace grid infrastructure 提示“[INS-40404] The installer has detected a configured instance of ..
- 出现 com.caucho.hessian.io.HessianServiceException: The service has no method named: XXX 异常的原因及解决方法
- VIII.1 INS-30510: Insufficient number of ASM disks selected.
- Caused by: org.hibernate.MappingException: collection foreign key mapping has wrong number of column
- Wrong number of indexes `1' inside [], expected `2'
- 用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载 、一直返回error
- 使用spring注入时出现 XXX is not writable or has an invalid setter method
- The number of method references in xxx.dex file cannot exceed 64K问题
- Android中string.xml的常识和相关内容
- 初学java疑问
- RAID磁盘阵列
- 【C语言疯狂讲义】(十四)预编译指令
- 主成分分析法及特征值的含义
- go的rpc出现提示:method Xxx has wrong number of ins: 1
- 人品计算器
- C语言课程设计
- iOS全局处理键盘事件
- 【C语言疯狂讲义】(十五)static和extern关键字使用
- 第十四周项目1-折腾二维数组
- 对C++中函数调用的引用传递的认识
- vagrant,Linux下利用代理进行apt-get下载
- 实例 26 买水果的小游戏