ソースを参照

Unify the defer syntax

A simple change to unify the http stream closing syntax.

Signed-off-by: Hamish Hutchings <hamish@aoeu.me>
Hamish Hutchings 6 年 前
コミット
6a3d1e3e3e
1 ファイル変更1 行追加1 行削除
  1. 1 1
      client/container_inspect.go

+ 1 - 1
client/container_inspect.go

@@ -19,10 +19,10 @@ func (cli *Client) ContainerInspect(ctx context.Context, containerID string) (ty
 	if err != nil {
 		return types.ContainerJSON{}, wrapResponseError(err, serverResp, "container", containerID)
 	}
+	defer ensureReaderClosed(serverResp)
 
 	var response types.ContainerJSON
 	err = json.NewDecoder(serverResp.body).Decode(&response)
-	ensureReaderClosed(serverResp)
 	return response, err
 }