Skip to content

Commit

Permalink
Package ioutil is deprecated from go 1.16 (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
khiemdoan authored Nov 12, 2024
1 parent 596cf99 commit 52bc389
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -501,7 +501,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
if err != nil {
return []byte{}, err
}
data, err = ioutil.ReadAll(res.Body)
data, err = io.ReadAll(res.Body)
if err != nil {
return []byte{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions v2/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package binance
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"net/url"
"testing"
Expand Down Expand Up @@ -88,7 +88,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {

func newHTTPResponse(data []byte, statusCode int) *http.Response {
return &http.Response{
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
Body: io.NopCloser(bytes.NewBuffer(data)),
StatusCode: statusCode,
}
}
Expand Down
4 changes: 2 additions & 2 deletions v2/delivery/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -326,7 +326,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
if err != nil {
return []byte{}, err
}
data, err = ioutil.ReadAll(res.Body)
data, err = io.ReadAll(res.Body)
if err != nil {
return []byte{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions v2/delivery/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package delivery
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"net/url"

Expand Down Expand Up @@ -85,7 +85,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {

func newHTTPResponse(data []byte, statusCode int) *http.Response {
return &http.Response{
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
Body: io.NopCloser(bytes.NewBuffer(data)),
StatusCode: statusCode,
}
}
Expand Down
4 changes: 2 additions & 2 deletions v2/futures/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -356,7 +356,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
if err != nil {
return []byte{}, &http.Header{}, err
}
data, err = ioutil.ReadAll(res.Body)
data, err = io.ReadAll(res.Body)
if err != nil {
return []byte{}, &http.Header{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions v2/futures/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package futures
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"net/url"

Expand Down Expand Up @@ -85,7 +85,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {

func newHTTPResponse(data []byte, statusCode int) *http.Response {
return &http.Response{
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
Body: io.NopCloser(bytes.NewBuffer(data)),
StatusCode: statusCode,
}
}
Expand Down
4 changes: 2 additions & 2 deletions v2/options/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -343,7 +343,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
if err != nil {
return []byte{}, &http.Header{}, err
}
data, err = ioutil.ReadAll(res.Body)
data, err = io.ReadAll(res.Body)
if err != nil {
return []byte{}, &http.Header{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions v2/options/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package options
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"net/url"

Expand Down Expand Up @@ -85,7 +85,7 @@ func anyHTTPRequest() mock.AnythingOfTypeArgument {

func newHTTPResponse(data []byte, statusCode int) *http.Response {
return &http.Response{
Body: ioutil.NopCloser(bytes.NewBuffer(data)),
Body: io.NopCloser(bytes.NewBuffer(data)),
StatusCode: statusCode,
}
}
Expand Down

0 comments on commit 52bc389

Please sign in to comment.