Skip to content

Commit d94ea66

Browse files
Simon Plourdeccressent
Simon Plourde
authored andcommitted
Pass empty pointer to json.Unmarshal when chunking (#2977)
Signed-off-by: Simon Plourde <[email protected]>
1 parent c589847 commit d94ea66

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cli/client/generic.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ func (client *RestClient) List(path string, objs interface{}, options *ListOptio
4646
panic("unexpected type for objs")
4747
}
4848

49-
newObjs := reflect.New(objsType.Elem())
50-
5149
for {
5250
request := client.R()
5351
ApplyListOptions(request, options)
@@ -61,6 +59,7 @@ func (client *RestClient) List(path string, objs interface{}, options *ListOptio
6159
return UnmarshalError(resp)
6260
}
6361

62+
newObjs := reflect.New(objsType.Elem())
6463
if err := json.Unmarshal(resp.Body(), newObjs.Interface()); err != nil {
6564
return err
6665
}

0 commit comments

Comments
 (0)