From 4c64a02c722c8d7cb00929111a14c7355f88a040 Mon Sep 17 00:00:00 2001 From: Matthias Fasching Date: Thu, 28 Apr 2022 13:35:46 +0200 Subject: [PATCH] Remove ioutil and replace with io/os functions --- plugins/plugins_test.go | 4 ++-- router_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/plugins_test.go b/plugins/plugins_test.go index 1f6317435..855850a1f 100644 --- a/plugins/plugins_test.go +++ b/plugins/plugins_test.go @@ -2,7 +2,7 @@ package plugins import ( "context" - "io/ioutil" + "os" "strings" "testing" "time" @@ -20,7 +20,7 @@ func TestAskBin_respectsTimeout(t *testing.T) { return } - if fileEntries, err := ioutil.ReadDir(from); err == nil { + if fileEntries, err := os.ReadDir(from); err == nil { found := false for _, e := range fileEntries { if strings.HasPrefix(e.Name(), "buffalo-") { diff --git a/router_test.go b/router_test.go index ff3584fa5..29bbdff3b 100644 --- a/router_test.go +++ b/router_test.go @@ -2,7 +2,7 @@ package buffalo import ( "fmt" - "io/ioutil" + "io" "net/http" "os" "path" @@ -98,7 +98,7 @@ func Test_Mount_Buffalo(t *testing.T) { r.NoError(err) res, err := http.DefaultClient.Do(req) r.NoError(err) - b, _ := ioutil.ReadAll(res.Body) + b, _ := io.ReadAll(res.Body) r.Equal(fmt.Sprintf("%s - %s/", m, u), string(b)) } } @@ -123,7 +123,7 @@ func Test_Mount_Buffalo_on_Group(t *testing.T) { r.NoError(err) res, err := http.DefaultClient.Do(req) r.NoError(err) - b, _ := ioutil.ReadAll(res.Body) + b, _ := io.ReadAll(res.Body) r.Equal(fmt.Sprintf("%s - %s/", m, u), string(b)) } } @@ -158,7 +158,7 @@ func Test_Mount_Handler(t *testing.T) { r.NoError(err) res, err := http.DefaultClient.Do(req) r.NoError(err) - b, _ := ioutil.ReadAll(res.Body) + b, _ := io.ReadAll(res.Body) r.Equal(fmt.Sprintf("%s - %s/", m, u), string(b)) } } @@ -197,7 +197,7 @@ func Test_PreHandlers(t *testing.T) { r.NoError(err) res, err := http.DefaultClient.Do(req) r.NoError(err) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) r.NoError(err) r.Equal(v.Code, res.StatusCode) r.Equal(v.Result, string(b)) @@ -242,7 +242,7 @@ func Test_PreWares(t *testing.T) { r.NoError(err) res, err := http.DefaultClient.Do(req) r.NoError(err) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) r.NoError(err) r.Equal(v.Code, res.StatusCode) r.Equal(v.Result, string(b)) @@ -269,7 +269,7 @@ func Test_Router(t *testing.T) { r.NoError(err) res, err := http.DefaultClient.Do(req) r.NoError(err) - b, _ := ioutil.ReadAll(res.Body) + b, _ := io.ReadAll(res.Body) r.Equal(fmt.Sprintf("%s|/router/tests", v), string(b)) } } @@ -552,7 +552,7 @@ func Test_Resource(t *testing.T) { r.NoError(err) res, err := c.Do(req) r.NoError(err) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) r.NoError(err) r.Equal(test.Result, string(b)) } @@ -710,7 +710,7 @@ func Test_ResourceOnResource(t *testing.T) { r.NoError(err) res, err := c.Do(req) r.NoError(err) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) r.NoError(err) r.Equal(test.Result, string(b)) }