tianxiaoliang commented on a change in pull request #826:
URL:
https://github.com/apache/servicecomb-service-center/pull/826#discussion_r554990110
##########
File path: server/service/gov/kie/kie_distributor.go
##########
@@ -42,8 +45,13 @@ func (d *Distributor) Create(kind, project string, spec
[]byte) ([]byte, error)
if err != nil {
return nil, err
}
+ if kind == MatchGroup {
+ err = d.generateID(project, p)
+ }
+ if err != nil {
Review comment:
err位置不对,放到49之后
##########
File path: server/service/gov/mock/mock.go
##########
@@ -98,14 +98,18 @@ func (d *Distributor) Display(project, app, env string)
([]byte, error) {
func (d *Distributor) List(kind, project, app, env string) ([]byte, error) {
r := make([]*gov.Policy, 0, len(d.lbPolicies))
for _, g := range d.lbPolicies {
- if g.Kind == kind && g.Selector.App == app &&
g.Selector.Environment == env {
+ if check(g, kind, app, env) {
r = append(r, g)
}
}
b, _ := json.MarshalIndent(r, "", " ")
return b, nil
}
+func check(g *gov.Policy, kind, app, env string) bool {
Review comment:
这个函数名不易读,不能一下子理解业务逻辑,要有具体的意义
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]