Fix error checking issue in json Decode

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
Madhu Rajanna 2019-01-17 13:07:40 +05:30
parent 1d11d0acc3
commit 4c564207c6

View File

@ -69,7 +69,7 @@ func getCephUser(adminCr *credentials, volID volumeID) (*cephEntity, error) {
// Contains non-json data: "exported keyring for ENTITY\n\n"
offset := bytes.Index(out, []byte("[{"))
if json.NewDecoder(bytes.NewReader(out[offset:])).Decode(&ents); err != nil {
if err = json.NewDecoder(bytes.NewReader(out[offset:])).Decode(&ents); err != nil {
return nil, fmt.Errorf("failed to decode json: %v", err)
}