Skip to content

Commit

Permalink
Avoid using deprecated package ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick authored and wendigo committed May 3, 2024
1 parent f321e3c commit 18d7885
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions trino/integration_tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/tls"
"database/sql"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -131,7 +130,7 @@ func newReverseProxyHandler(serverURL *url.URL, cproxyURL chan string) http.Hand
w.WriteHeader(resp.StatusCode)
pr, pw := io.Pipe()
go func() {
b, err := ioutil.ReadAll(resp.Body)
b, err := io.ReadAll(resp.Body)
if err != nil {
pw.CloseWithError(err)
return
Expand Down
6 changes: 3 additions & 3 deletions trino/trino.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"net/http"
"net/url"
"os"
"reflect"
"sort"
"strconv"
Expand Down Expand Up @@ -326,7 +326,7 @@ func newConn(dsn string) (*Conn, error) {
cert := []byte(query.Get(sslCertConfig))

if certPath := query.Get(sslCertPathConfig); certPath != "" {
cert, err = ioutil.ReadFile(certPath)
cert, err = os.ReadFile(certPath)
if err != nil {
return nil, fmt.Errorf("trino: Error loading SSL Cert File: %w", err)
}
Expand Down Expand Up @@ -575,7 +575,7 @@ func newErrQueryFailedFromResponse(resp *http.Response) *ErrQueryFailed {
const maxBytes = 8 * 1024
defer resp.Body.Close()
qf := &ErrQueryFailed{StatusCode: resp.StatusCode}
b, err := ioutil.ReadAll(io.LimitReader(resp.Body, maxBytes))
b, err := io.ReadAll(io.LimitReader(resp.Body, maxBytes))
if err != nil {
qf.Reason = err
return qf
Expand Down

0 comments on commit 18d7885

Please sign in to comment.