From 7e9dcce3cb02a3c7f42c96dda1deb26af490d9d9 Mon Sep 17 00:00:00 2001 From: Igor Dolzhikov Date: Mon, 27 Oct 2014 00:47:54 +0600 Subject: [PATCH] second excluding of unused transformation sorry, could not grep it all before --- shared/build/docker/client.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/shared/build/docker/client.go b/shared/build/docker/client.go index 41fc48b7d..bc0171bd8 100644 --- a/shared/build/docker/client.go +++ b/shared/build/docker/client.go @@ -214,12 +214,8 @@ func (c *Client) do(method, path string, in, out interface{}) error { return err } - // Read the bytes from the body (make sure we defer close the body) + // make sure we defer close the body defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } // Check for an http error status (ie not 200 StatusOK) switch resp.StatusCode { @@ -233,9 +229,9 @@ func (c *Client) do(method, path string, in, out interface{}) error { return ErrBadRequest } - // Unmarshall the JSON response + // Decode the JSON response if out != nil { - return json.Unmarshal(body, out) + return json.NewDecoder(resp.Body).Decode(out) } return nil