method.Type.NumIn() => method.Type.NumOut()

This commit is contained in:
Dai Jie
2020-11-22 22:31:44 +08:00
committed by GitHub
parent 832bc34815
commit ffda6972f3
+3 -3
View File
@@ -80,8 +80,8 @@ func main() {
for i := 0; i < typ.NumMethod(); i++ {
method := typ.Method(i)
argv := make([]string, 0, method.Type.NumIn())
returns := make([]string, 0, method.Type.NumIn())
// j 从 1 开始,第 0 个入参是 wg 自己。
returns := make([]string, 0, method.Type.NumOut())
// j 从 1 开始,第 0 个入参是 wg 自己。
for j := 1; j < method.Type.NumIn(); j++ {
argv = append(argv, method.Type.In(j).Name())
}
@@ -494,4 +494,4 @@ start rpc server on [::]:57509
## 附 推荐阅读
- [Go 语言简明教程](https://geektutu.com/post/quick-golang.html)
- [Go 语言笔试面试题](https://geektutu.com/post/qa-golang.html)
- [Go 语言笔试面试题](https://geektutu.com/post/qa-golang.html)