From bbe4b0d3de87683b1824ca77f862b36df4229f44 Mon Sep 17 00:00:00 2001 From: guangwu Date: Thu, 22 Jun 2023 18:19:23 +0800 Subject: [PATCH] chore: remove refs to deprecated io/ioutil (#70300) --- devenv/docker/ha-test-unified-alerting/webhook-listener.go | 4 ++-- pkg/services/ngalert/sender/notifier_ext.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/devenv/docker/ha-test-unified-alerting/webhook-listener.go b/devenv/docker/ha-test-unified-alerting/webhook-listener.go index 18724ec2a84..d742db681b0 100644 --- a/devenv/docker/ha-test-unified-alerting/webhook-listener.go +++ b/devenv/docker/ha-test-unified-alerting/webhook-listener.go @@ -4,7 +4,7 @@ import ( "encoding/json" "flag" "fmt" - "io/ioutil" + "io" "log" "net/http" "os" @@ -129,7 +129,7 @@ func main() { http.HandleFunc("/listen", func(w http.ResponseWriter, r *http.Request) { log.Printf("got submission from: %s\n", r.RemoteAddr) - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) if err != nil { log.Println(err) w.WriteHeader(http.StatusBadRequest) diff --git a/pkg/services/ngalert/sender/notifier_ext.go b/pkg/services/ngalert/sender/notifier_ext.go index f96875fed16..27effd18913 100644 --- a/pkg/services/ngalert/sender/notifier_ext.go +++ b/pkg/services/ngalert/sender/notifier_ext.go @@ -12,7 +12,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "sync" "time" @@ -184,7 +183,7 @@ func (n *Manager) sendOne(ctx context.Context, c *http.Client, url string, b []b return err } defer func() { - io.Copy(ioutil.Discard, resp.Body) + io.Copy(io.Discard, resp.Body) resp.Body.Close() }()