Skip to content

Commit 52bc389

Browse files
authored
Package ioutil is deprecated from go 1.16 (#628)
1 parent 596cf99 commit 52bc389

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

v2/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"context"
66
"crypto/tls"
77
"fmt"
8-
"io/ioutil"
8+
"io"
99
"log"
1010
"net/http"
1111
"net/url"
@@ -501,7 +501,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
501501
if err != nil {
502502
return []byte{}, err
503503
}
504-
data, err = ioutil.ReadAll(res.Body)
504+
data, err = io.ReadAll(res.Body)
505505
if err != nil {
506506
return []byte{}, err
507507
}

v2/client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package binance
33
import (
44
"bytes"
55
"context"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"net/url"
99
"testing"
@@ -88,7 +88,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {
8888

8989
func newHTTPResponse(data []byte, statusCode int) *http.Response {
9090
return &http.Response{
91-
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
91+
Body: io.NopCloser(bytes.NewBuffer(data)),
9292
StatusCode: statusCode,
9393
}
9494
}

v2/delivery/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"crypto/tls"
77
"encoding/json"
88
"fmt"
9-
"io/ioutil"
9+
"io"
1010
"log"
1111
"net/http"
1212
"net/url"
@@ -326,7 +326,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
326326
if err != nil {
327327
return []byte{}, err
328328
}
329-
data, err = ioutil.ReadAll(res.Body)
329+
data, err = io.ReadAll(res.Body)
330330
if err != nil {
331331
return []byte{}, err
332332
}

v2/delivery/client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package delivery
33
import (
44
"bytes"
55
"context"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"net/url"
99

@@ -85,7 +85,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {
8585

8686
func newHTTPResponse(data []byte, statusCode int) *http.Response {
8787
return &http.Response{
88-
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
88+
Body: io.NopCloser(bytes.NewBuffer(data)),
8989
StatusCode: statusCode,
9090
}
9191
}

v2/futures/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"crypto/tls"
77
"encoding/json"
88
"fmt"
9-
"io/ioutil"
9+
"io"
1010
"log"
1111
"net/http"
1212
"net/url"
@@ -356,7 +356,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
356356
if err != nil {
357357
return []byte{}, &http.Header{}, err
358358
}
359-
data, err = ioutil.ReadAll(res.Body)
359+
data, err = io.ReadAll(res.Body)
360360
if err != nil {
361361
return []byte{}, &http.Header{}, err
362362
}

v2/futures/client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package futures
33
import (
44
"bytes"
55
"context"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"net/url"
99

@@ -85,7 +85,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {
8585

8686
func newHTTPResponse(data []byte, statusCode int) *http.Response {
8787
return &http.Response{
88-
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
88+
Body: io.NopCloser(bytes.NewBuffer(data)),
8989
StatusCode: statusCode,
9090
}
9191
}

v2/options/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"crypto/tls"
77
"encoding/json"
88
"fmt"
9-
"io/ioutil"
9+
"io"
1010
"log"
1111
"net/http"
1212
"net/url"
@@ -343,7 +343,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
343343
if err != nil {
344344
return []byte{}, &http.Header{}, err
345345
}
346-
data, err = ioutil.ReadAll(res.Body)
346+
data, err = io.ReadAll(res.Body)
347347
if err != nil {
348348
return []byte{}, &http.Header{}, err
349349
}

v2/options/client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package options
33
import (
44
"bytes"
55
"context"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"net/url"
99

@@ -85,7 +85,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {
8585

8686
func newHTTPResponse(data []byte, statusCode int) *http.Response {
8787
return &http.Response{
88-
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
88+
Body: io.NopCloser(bytes.NewBuffer(data)),
8989
StatusCode: statusCode,
9090
}
9191
}

0 commit comments

Comments
 (0)