chore: remove refs to deprecated io/ioutil (#70300)

pull/70505/head
guangwu 2 years ago committed by GitHub
parent b2f9a3a222
commit bbe4b0d3de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      devenv/docker/ha-test-unified-alerting/webhook-listener.go
  2. 3
      pkg/services/ngalert/sender/notifier_ext.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)

@ -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()
}()

Loading…
Cancel
Save