From 2fcef3353eb2f7664d3b0416ec3f8ffc59b7f6cf Mon Sep 17 00:00:00 2001 From: yamasaki Date: Wed, 21 Jun 2023 21:50:42 +0900 Subject: [PATCH] refactor : no use ioutil Signed-off-by: yamasaki --- sling.go | 3 +-- sling_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sling.go b/sling.go index 57d7ad5..5492ef2 100644 --- a/sling.go +++ b/sling.go @@ -3,7 +3,6 @@ package sling import ( "encoding/base64" "io" - "io/ioutil" "net/http" "net/url" @@ -390,7 +389,7 @@ func (s *Sling) Do(req *http.Request, successV, failureV interface{}) (*http.Res // reuse HTTP/1.x "keep-alive" TCP connections if the Body is // not read to completion and closed. // See: https://golang.org/pkg/net/http/#Response - defer io.Copy(ioutil.Discard, resp.Body) + defer io.Copy(io.Discard, resp.Body) // Don't try to decode on 204s or Content-Length is 0 if resp.StatusCode == http.StatusNoContent || resp.ContentLength == 0 { diff --git a/sling_test.go b/sling_test.go index 5d4c1ef..370c920 100644 --- a/sling_test.go +++ b/sling_test.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "net" "net/http" @@ -385,7 +384,7 @@ func TestBodyFormSetter(t *testing.T) { } func TestBodySetter(t *testing.T) { - fakeInput := ioutil.NopCloser(strings.NewReader("test")) + fakeInput := io.NopCloser(strings.NewReader("test")) fakeBodyProvider := bodyProvider{body: fakeInput} cases := []struct {