Minor Go-style suggeston: move decode and error assignment into if clause check.
This commit is contained in:
parent
eb54622568
commit
87768a047c
@ -172,8 +172,7 @@ func getContainerInfoRequest(body io.ReadCloser) (*info.ContainerInfoRequest, er
|
|||||||
query.NumStats = 64
|
query.NumStats = 64
|
||||||
|
|
||||||
decoder := json.NewDecoder(body)
|
decoder := json.NewDecoder(body)
|
||||||
err := decoder.Decode(&query)
|
if err := decoder.Decode(&query); err != nil && err != io.EOF {
|
||||||
if err != nil && err != io.EOF {
|
|
||||||
return nil, fmt.Errorf("unable to decode the json value: %s", err)
|
return nil, fmt.Errorf("unable to decode the json value: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user