From d94ea66db09a7587f7ed6968dbb03fa7eebc91e0 Mon Sep 17 00:00:00 2001 From: Simon Plourde Date: Tue, 21 May 2019 15:34:25 -0400 Subject: [PATCH] Pass empty pointer to json.Unmarshal when chunking (#2977) Signed-off-by: Simon Plourde --- cli/client/generic.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/client/generic.go b/cli/client/generic.go index e1488aadd4..1e78e68265 100644 --- a/cli/client/generic.go +++ b/cli/client/generic.go @@ -46,8 +46,6 @@ func (client *RestClient) List(path string, objs interface{}, options *ListOptio panic("unexpected type for objs") } - newObjs := reflect.New(objsType.Elem()) - for { request := client.R() ApplyListOptions(request, options) @@ -61,6 +59,7 @@ func (client *RestClient) List(path string, objs interface{}, options *ListOptio return UnmarshalError(resp) } + newObjs := reflect.New(objsType.Elem()) if err := json.Unmarshal(resp.Body(), newObjs.Interface()); err != nil { return err }