simplify err.Error() to err when used in printf context (#1603)

This commit is contained in:
mmetc 2022-06-22 15:53:53 +02:00 committed by GitHub
parent 3c6834fc18
commit 628d7be1d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 90 additions and 90 deletions

View file

@ -73,13 +73,13 @@ func (s *Splunk) Notify(ctx context.Context, notification *protobufs.Notificatio
if resp.StatusCode != 200 {
content, err := ioutil.ReadAll(resp.Body)
if err != nil {
return &protobufs.Empty{}, fmt.Errorf("got non 200 response and failed to read error %s", string(err.Error()))
return &protobufs.Empty{}, fmt.Errorf("got non 200 response and failed to read error %s", err)
}
return &protobufs.Empty{}, fmt.Errorf("got non 200 response %s", string(content))
}
respData, err := ioutil.ReadAll(resp.Body)
if err != nil {
return &protobufs.Empty{}, fmt.Errorf("failed to read response body got error %s", string(err.Error()))
return &protobufs.Empty{}, fmt.Errorf("failed to read response body got error %s", err)
}
logger.Debug(fmt.Sprintf("got response %s", string(respData)))
return &protobufs.Empty{}, nil