Skip to content

Commit

Permalink
Merge pull request #869 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
k8s-ci-robot authored Jul 21, 2023
2 parents 2503346 + 62c611a commit 02d7070
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions pkg/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/validation-webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 02d7070

Please sign in to comment.