From cb51f93b1bb3dfa65d7ba04c422bf79de0090e2d Mon Sep 17 00:00:00 2001 From: zhanluxianshen Date: Sun, 17 Mar 2024 01:58:10 +0000 Subject: [PATCH] Drop ioutil package. Signed-off-by: zhanluxianshen --- internal/pkg/notifications/client.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/pkg/notifications/client.go b/internal/pkg/notifications/client.go index a35ee017..d1cf5a4d 100644 --- a/internal/pkg/notifications/client.go +++ b/internal/pkg/notifications/client.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "fmt" "io" - "io/ioutil" "net/http" "net/url" "strings" @@ -53,12 +52,12 @@ func (c Client) Request(endpoint string, requestBody string, headers map[string] defer resp.Body.Close() if resp.StatusCode/100 != 2 { - b, _ := ioutil.ReadAll(resp.Body) // try to read response body as well to give user more info why request failed + b, _ := io.ReadAll(resp.Body) // try to read response body as well to give user more info why request failed return fmt.Errorf("%s %s returned %d %s, expected 2xx", "POST", endpoint, resp.StatusCode, strings.TrimSuffix(string(b), "\n")) } - if _, err = io.Copy(ioutil.Discard, resp.Body); err != nil { + if _, err = io.Copy(io.Discard, resp.Body); err != nil { return fmt.Errorf("read response body: %s %s: %v", "POST", endpoint, err) } return nil