diff --git a/pkg/metrics/metrics_test.go b/pkg/metrics/metrics_test.go index bb840a038..be38a4baa 100644 --- a/pkg/metrics/metrics_test.go +++ b/pkg/metrics/metrics_test.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "log" "net" "net/http" @@ -119,7 +118,7 @@ func TestRecordMetricsForNonExistingOperation(t *testing.T) { if err != nil || rsp.StatusCode != http.StatusOK { t.Errorf("failed to get response from server %v, %v", err, rsp) } - r, err := ioutil.ReadAll(rsp.Body) + r, err := io.ReadAll(rsp.Body) if err != nil { t.Errorf("failed to read response body %v", err) } @@ -144,7 +143,7 @@ func TestDropOperation(t *testing.T) { if err != nil || rsp.StatusCode != http.StatusOK { t.Errorf("failed to get response from server %v, %v", err, rsp) } - r, err := ioutil.ReadAll(rsp.Body) + r, err := io.ReadAll(rsp.Body) if err != nil { t.Errorf("failed to read response body %v", err) } @@ -554,7 +553,7 @@ func verifyInFlightMetric(expected string, srvAddr string) error { if rsp.StatusCode != http.StatusOK { return fmt.Errorf("failed to get response from serve: %s", http.StatusText(rsp.StatusCode)) } - r, err := ioutil.ReadAll(rsp.Body) + r, err := io.ReadAll(rsp.Body) if err != nil { return err } @@ -574,7 +573,7 @@ func verifyMetric(expected, srvAddr string) error { if rsp.StatusCode != http.StatusOK { return fmt.Errorf("failed to get response from serve: %s", http.StatusText(rsp.StatusCode)) } - r, err := ioutil.ReadAll(rsp.Body) + r, err := io.ReadAll(rsp.Body) if err != nil { return err } diff --git a/pkg/validation-webhook/webhook.go b/pkg/validation-webhook/webhook.go index 6da0b8a53..09beecfdc 100644 --- a/pkg/validation-webhook/webhook.go +++ b/pkg/validation-webhook/webhook.go @@ -21,7 +21,7 @@ import ( "crypto/tls" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" @@ -108,7 +108,7 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitHandler) { http.Error(w, msg, http.StatusBadRequest) } - data, err := ioutil.ReadAll(r.Body) + data, err := io.ReadAll(r.Body) if err != nil { msg := fmt.Sprintf("Request could not be decoded: %v", err) klog.Error(msg)