Browse code

Use local variable err instead of a outer one

Signed-off-by: Hu Keping <hukeping@huawei.com>

Hu Keping authored on 2015/04/15 01:29:53
Showing 1 changed files
... ...
@@ -506,8 +506,7 @@ func getContainersTop(eng *engine.Engine, version version.Version, w http.Respon
506 506
 }
507 507
 
508 508
 func getContainersJSON(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
509
-	var err error
510
-	if err = parseForm(r); err != nil {
509
+	if err := parseForm(r); err != nil {
511 510
 		return err
512 511
 	}
513 512
 
... ...
@@ -520,10 +519,11 @@ func getContainersJSON(eng *engine.Engine, version version.Version, w http.Respo
520 520
 	}
521 521
 
522 522
 	if tmpLimit := r.Form.Get("limit"); tmpLimit != "" {
523
-		config.Limit, err = strconv.Atoi(tmpLimit)
523
+		limit, err := strconv.Atoi(tmpLimit)
524 524
 		if err != nil {
525 525
 			return err
526 526
 		}
527
+		config.Limit = limit
527 528
 	}
528 529
 
529 530
 	containers, err := getDaemon(eng).Containers(config)