Skip to content

Commit

Permalink
Merge branch 'ioutil/third_party' into f/go1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
khrm committed Feb 23, 2023
2 parents bc37251 + c741b18 commit 8849014
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions third_party/github.com/hashicorp/go-retryablehttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"crypto/x509"
"fmt"
"io"
"io/ioutil"
"log"
"math"
"math/rand"
Expand Down Expand Up @@ -224,7 +223,7 @@ func getBodyReaderAndContentLength(rawBody interface{}) (ReaderFunc, int64, erro
// deal with it seeking so want it to match here instead of the
// io.ReadSeeker case.
case *bytes.Reader:
buf, err := ioutil.ReadAll(body)
buf, err := io.ReadAll(body)
if err != nil {
return nil, 0, err
}
Expand All @@ -238,15 +237,15 @@ func getBodyReaderAndContentLength(rawBody interface{}) (ReaderFunc, int64, erro
raw := body
bodyReader = func() (io.Reader, error) {
_, err := raw.Seek(0, 0)
return ioutil.NopCloser(raw), err
return io.NopCloser(raw), err
}
if lr, ok := raw.(LenReader); ok {
contentLength = int64(lr.Len())
}

// Read all in so we can reset
case io.Reader:
buf, err := ioutil.ReadAll(body)
buf, err := io.ReadAll(body)
if err != nil {
return nil, 0, err
}
Expand Down Expand Up @@ -602,7 +601,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
if c, ok := body.(io.ReadCloser); ok {
req.Body = c
} else {
req.Body = ioutil.NopCloser(body)
req.Body = io.NopCloser(body)
}
}

Expand Down Expand Up @@ -738,7 +737,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
// Try to read the response body so we can reuse this connection.
func (c *Client) drainBody(body io.ReadCloser) {
defer body.Close()
_, err := io.Copy(ioutil.Discard, io.LimitReader(body, respReadLimit))
_, err := io.Copy(io.Discard, io.LimitReader(body, respReadLimit))
if err != nil {
if c.logger() != nil {
switch v := c.logger().(type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ type LRUCache interface {
// Clears all cache entries.
Purge()

// Resizes cache, returning number evicted
Resize(int) int
// Resizes cache, returning number evicted
Resize(int) int
}

0 comments on commit 8849014

Please sign in to comment.