Skip to content

Commit 02d7070

Browse files
authored
Merge pull request #869 from testwill/ioutil
chore: remove refs to deprecated io/ioutil
2 parents 2503346 + 62c611a commit 02d7070

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pkg/metrics/metrics_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"fmt"
2222
"io"
23-
"io/ioutil"
2423
"log"
2524
"net"
2625
"net/http"
@@ -119,7 +118,7 @@ func TestRecordMetricsForNonExistingOperation(t *testing.T) {
119118
if err != nil || rsp.StatusCode != http.StatusOK {
120119
t.Errorf("failed to get response from server %v, %v", err, rsp)
121120
}
122-
r, err := ioutil.ReadAll(rsp.Body)
121+
r, err := io.ReadAll(rsp.Body)
123122
if err != nil {
124123
t.Errorf("failed to read response body %v", err)
125124
}
@@ -144,7 +143,7 @@ func TestDropOperation(t *testing.T) {
144143
if err != nil || rsp.StatusCode != http.StatusOK {
145144
t.Errorf("failed to get response from server %v, %v", err, rsp)
146145
}
147-
r, err := ioutil.ReadAll(rsp.Body)
146+
r, err := io.ReadAll(rsp.Body)
148147
if err != nil {
149148
t.Errorf("failed to read response body %v", err)
150149
}
@@ -554,7 +553,7 @@ func verifyInFlightMetric(expected string, srvAddr string) error {
554553
if rsp.StatusCode != http.StatusOK {
555554
return fmt.Errorf("failed to get response from serve: %s", http.StatusText(rsp.StatusCode))
556555
}
557-
r, err := ioutil.ReadAll(rsp.Body)
556+
r, err := io.ReadAll(rsp.Body)
558557
if err != nil {
559558
return err
560559
}
@@ -574,7 +573,7 @@ func verifyMetric(expected, srvAddr string) error {
574573
if rsp.StatusCode != http.StatusOK {
575574
return fmt.Errorf("failed to get response from serve: %s", http.StatusText(rsp.StatusCode))
576575
}
577-
r, err := ioutil.ReadAll(rsp.Body)
576+
r, err := io.ReadAll(rsp.Body)
578577
if err != nil {
579578
return err
580579
}

pkg/validation-webhook/webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"crypto/tls"
2222
"encoding/json"
2323
"fmt"
24-
"io/ioutil"
24+
"io"
2525
"net/http"
2626
"os"
2727

@@ -108,7 +108,7 @@ func serve(w http.ResponseWriter, r *http.Request, admit admitHandler) {
108108
http.Error(w, msg, http.StatusBadRequest)
109109
}
110110

111-
data, err := ioutil.ReadAll(r.Body)
111+
data, err := io.ReadAll(r.Body)
112112
if err != nil {
113113
msg := fmt.Sprintf("Request could not be decoded: %v", err)
114114
klog.Error(msg)

0 commit comments

Comments
 (0)