fix bodyclose linter

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Tim Ramlot 2024-04-29 15:26:34 +02:00
parent 085136068a
commit 31eec1f8ab
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D
3 changed files with 3 additions and 1 deletions

View File

@ -11,7 +11,6 @@ issues:
- exhaustive
- gocritic
- nilerr
- bodyclose
- loggercheck
- forbidigo
- interfacebloat

View File

@ -243,11 +243,13 @@ func stabilizeError(err error) error {
var authErr *azidentity.AuthenticationFailedError
if errors.As(err, &authErr) {
//nolint: bodyclose // False positive, this already a processed body, probably just pointing to a buffer.
authErr.RawResponse = redactResponse(authErr.RawResponse)
}
var respErr *azcore.ResponseError
if errors.As(err, &respErr) {
//nolint: bodyclose // False positive, this already a processed body, probably just pointing to a buffer.
respErr.RawResponse = redactResponse(respErr.RawResponse)
}

View File

@ -135,6 +135,7 @@ func TestMetricsController(t *testing.T) {
if err != nil {
return err
}
defer resp.Body.Close()
output, err := io.ReadAll(resp.Body)
if err != nil {