tianxiaoliang commented on a change in pull request #107: #103 topic support 
none label cases
URL: https://github.com/apache/servicecomb-kie/pull/107#discussion_r386231616
 
 

 ##########
 File path: server/pubsub/struct.go
 ##########
 @@ -60,14 +62,16 @@ func ParseTopicString(s string) (*Topic, error) {
        if err != nil {
                return nil, err
        }
-       ls := strings.Split(t.LabelsFormat, "::")
-       if len(ls) != 0 {
-               for _, l := range ls {
-                       s := strings.Split(l, "=")
-                       if len(s) != 2 {
-                               return nil, errors.New("invalid label:" + l)
+       if t.LabelsFormat != stringutil.LabelNone {
 
 Review comment:
   if t.LabelsFormat != stringutil.LabelNone 是一种稀有出现条件,不如编写if t.LabelsFormat -= 
stringutil.LabelNone 然后返回topic,nil 代码更加简洁,减少了嵌套

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to