deleteMultiple(): don't lose `resp.Body.Close()` errors

Since this function doesn't used a named parameter for its `error`
result, `checkClose()` would just lose any errors. Instead, call
`resp.Body.Close()` inline where it is needed.
This commit is contained in:
Michael Haggerty 2021-09-06 15:22:34 +02:00
Родитель 5e81bc116f
Коммит b6e522f8fc
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -83,11 +83,15 @@ func deleteMultiple(c *Config, b *Bucket, quiet bool, keys []string) (DeleteResu
if resp.StatusCode != 200 {
return DeleteResult{}, newRespError(resp)
}
defer checkClose(resp.Body, err)
var result DeleteResult
decoder := xml.NewDecoder(resp.Body)
if err := decoder.Decode(&result); err != nil {
_ = resp.Body.Close()
return DeleteResult{}, err
}
if err := resp.Body.Close(); err != nil {
return DeleteResult{}, err
}