You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/01 01:47:45 UTC

[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #888: fix json unmarshal error when list plguins

tokers commented on a change in pull request #888:
URL: https://github.com/apache/apisix-ingress-controller/pull/888#discussion_r816386059



##########
File path: pkg/apisix/cluster.go
##########
@@ -750,10 +750,16 @@ func (c *cluster) getList(ctx context.Context, url, resource string) ([]string,
 		return nil, err
 	}
 
-	var listResponse []string
+	var listResponse map[string]interface{}
 	dec := json.NewDecoder(resp.Body)
 	if err := dec.Decode(&listResponse); err != nil {
 		return nil, err
 	}
-	return listResponse, nil
+	var res []string = make([]string, len(listResponse))

Review comment:
       ```suggestion
   	res []string := make([]string, 0, len(listResponse))
   ```
   
   After that, just using `append`, we don't need the indice `i`.




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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org