Skip to content

Commit eacb79c

Browse files
author
tim
committed
fix: 只保存第一个 op 操作结果
1 parent 492932d commit eacb79c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

parse.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,10 @@ func (o *ProtoParseItem) parseRPC(r *proto.RPC) {
6161
Operation: funcName,
6262
GroupName: groupName,
6363
}
64-
v, ok := o.GroupFunc[groupName]
65-
if ok {
66-
v = append(v, item)
67-
continue
64+
_, ok := o.GroupFunc[groupName]
65+
if !ok {
66+
o.GroupFunc[groupName] = make([]FuncParseItem, 0)
6867
}
69-
o.GroupFunc[groupName] = make([]FuncParseItem, 0)
7068
o.GroupFunc[groupName] = append(o.GroupFunc[groupName], item)
7169
}
7270
}

tests/pb/test.operation.pb.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package pb
22

33
var TestServerOperationGroup = map[string][]string{
44
"auth": {
5-
"cart.service.v1.Cart.GetCart",
5+
"/cart.service.v1.Cart/GetCart",
6+
"/cart.service.v1.Cart/DeleteCart",
67
},
78
"auth2": {
8-
"cart.service.v1.Cart.GetCart",
9+
"/cart.service.v1.Cart/GetCart",
10+
"/cart.service.v1.Cart/DeleteCart",
911
},
1012
}
1113

tests/pb/test.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ service Cart {
1010
// @tags: auth,auth2
1111
rpc GetCart (GetCartReq) returns (GetCartReply) {}
1212
// comment
13-
// @tags:
13+
// @tags: auth,auth2
1414
rpc DeleteCart (DeleteCartReq) returns (DeleteCartReply) {}
1515

1616
rpc AddItem (AddItemReq) returns (AddItemReply) {}

0 commit comments

Comments
 (0)