@@ -10,10 +10,11 @@ import (
1010 "strconv"
1111 "strings"
1212
13- "github.com/YYCoder/protobuf-thrift/utils"
14- "github.com/YYCoder/protobuf-thrift/utils/logger"
1513 "github.com/emicklei/proto"
1614 goThrift "github.com/samuel/go-thrift/parser"
15+
16+ "github.com/YYCoder/protobuf-thrift/utils"
17+ "github.com/YYCoder/protobuf-thrift/utils/logger"
1718)
1819
1920type protoGenerator struct {
@@ -158,15 +159,21 @@ func (g *protoGenerator) handleService(s *goThrift.Service) {
158159 }
159160 for _ , i := range s .Methods {
160161 // type convert
161- reqType , err := g .typeConverter (i .Arguments [0 ].Type )
162- if err != nil {
163- logger .Errorf ("Invalid requestType %v" , err )
164- continue
162+ var reqType , resType string
163+ var err error
164+ if len (i .Arguments ) > 0 {
165+ reqType , err = g .typeConverter (i .Arguments [0 ].Type )
166+ if err != nil {
167+ logger .Errorf ("Invalid requestType %v" , err )
168+ continue
169+ }
165170 }
166- resType , err := g .typeConverter (i .ReturnType )
167- if err != nil {
168- logger .Errorf ("Invalid returnType %v" , err )
169- continue
171+ if i .ReturnType != nil {
172+ resType , err = g .typeConverter (i .ReturnType )
173+ if err != nil {
174+ logger .Errorf ("Invalid returnType %v" , err )
175+ continue
176+ }
170177 }
171178
172179 method := & proto.RPC {
0 commit comments