diff options
| author | Taras Madan <tarasmadan@google.com> | 2023-02-23 14:28:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-23 14:28:18 +0100 |
| commit | 4359978ef22a22ddd5a19adf18cbc80cb44244fb (patch) | |
| tree | 7952da94e27417b39ddf952d9e0bab431dafc4c5 /dashboard | |
| parent | 9e2ebb3c174f1e168bc1fbadd5f02f2e25e314fc (diff) | |
all: ioutil is deprecated in go1.19 (#3718)
Diffstat (limited to 'dashboard')
| -rw-r--r-- | dashboard/app/api.go | 6 | ||||
| -rw-r--r-- | dashboard/app/reporting_email.go | 4 | ||||
| -rw-r--r-- | dashboard/app/util_test.go | 4 | ||||
| -rw-r--r-- | dashboard/dashapi/dashapi.go | 3 |
4 files changed, 8 insertions, 9 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 9b15c11a4..2ba4f1a9f 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -8,7 +8,7 @@ import ( "compress/gzip" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "reflect" @@ -146,7 +146,7 @@ func handleAPI(c context.Context, r *http.Request) (reply interface{}, err error if err != nil { return nil, fmt.Errorf("failed to ungzip payload: %v", err) } - payload, err = ioutil.ReadAll(gr) + payload, err = io.ReadAll(gr) if err != nil { return nil, fmt.Errorf("failed to ungzip payload: %v", err) } @@ -1489,7 +1489,7 @@ func getText(c context.Context, tag string, id int64) ([]byte, string, error) { if err != nil { return nil, "", fmt.Errorf("failed to read text %v: %v", tag, err) } - data, err := ioutil.ReadAll(d) + data, err := io.ReadAll(d) if err != nil { return nil, "", fmt.Errorf("failed to read text %v: %v", tag, err) } diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index 253851872..3c198792a 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -8,7 +8,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "net/mail" "regexp" @@ -465,7 +465,7 @@ func handleTestCommand(c context.Context, info *bugInfoResult, msg *email.Email) func handleEmailBounce(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { log.Errorf(c, "email bounced: failed to read body: %v", err) return diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go index 3d396b05c..83076d54f 100644 --- a/dashboard/app/util_test.go +++ b/dashboard/app/util_test.go @@ -9,7 +9,7 @@ package main import ( "bytes" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "os" @@ -394,7 +394,7 @@ func (c *Ctx) makeClient(client, key string, failOnErrors bool) *apiClient { res := &http.Response{ StatusCode: w.Code, Status: http.StatusText(w.Code), - Body: ioutil.NopCloser(w.Result().Body), + Body: io.NopCloser(w.Result().Body), } return res, nil } diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index d3ee7bae3..be1cd2fd5 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -11,7 +11,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/mail" "net/url" @@ -808,7 +807,7 @@ func (dash *Dashboard) queryImpl(method string, req, reply interface{}) error { } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - data, _ := ioutil.ReadAll(resp.Body) + data, _ := io.ReadAll(resp.Body) return fmt.Errorf("request failed with %v: %s", resp.Status, data) } if reply != nil { |
