Skip to content

Commit

Permalink
any --> interface{}
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Jan 27, 2022
1 parent 580c574 commit 2ad7011
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion header.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s *headerSorter) Swap(i, j int) { s.kvs[i], s.kvs[j] = s.kvs[j], s.kv
func (s *headerSorter) Less(i, j int) bool { return s.kvs[i].key < s.kvs[j].key }

var headerSorterPool = sync.Pool{
New: func() any { return new(headerSorter) },
New: func() interface{} { return new(headerSorter) },
}

// get is like Get, but key must already be in CanonicalHeaderKey form.
Expand Down
2 changes: 1 addition & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package req
import (
"encoding/base64"
"fmt"
"github.com/imroc/req/internal/ascii"
"github.com/imroc/req/v2/internal/ascii"
"golang.org/x/net/http/httpguts"
"golang.org/x/net/idna"
"io"
Expand Down
6 changes: 3 additions & 3 deletions transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type transferWriter struct {
ByteReadCh chan readResult // non-nil if probeRequestBody called
}

func newTransferWriter(r any) (t *transferWriter, err error) {
func newTransferWriter(r interface{}) (t *transferWriter, err error) {
t = &transferWriter{}

// Extract relevant fields
Expand Down Expand Up @@ -493,7 +493,7 @@ func suppressedHeaders(status int) []string {
}

// msg is *http.Request or *http.Response.
func readTransfer(msg any, r *bufio.Reader) (err error) {
func readTransfer(msg interface{}, r *bufio.Reader) (err error) {
t := &transferReader{RequestMethod: "GET"}

// Unify input
Expand Down Expand Up @@ -821,7 +821,7 @@ func fixTrailer(header http.Header, chunked bool) (http.Header, error) {
// and then reads the trailer if necessary.
type body struct {
src io.Reader
hdr any // non-nil (Response or Request) value means read trailer
hdr interface{} // non-nil (Response or Request) value means read trailer
r *bufio.Reader // underlying wire-format reader for the trailer
closing bool // is the connection to be closed after reading body?
doEarlyClose bool // whether Close should stop early
Expand Down
4 changes: 2 additions & 2 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -2706,8 +2706,8 @@ func (pc *persistConn) roundTrip(req *transportRequest) (resp *http.Response, er
// a t.Logf func. See export_test.go's Request.WithT method.
type tLogKey struct{}

func (tr *transportRequest) logf(format string, args ...any) {
if logf, ok := tr.Request.Context().Value(tLogKey{}).(func(string, ...any)); ok {
func (tr *transportRequest) logf(format string, args ...interface{}) {
if logf, ok := tr.Request.Context().Value(tLogKey{}).(func(string, ...interface{})); ok {
logf(time.Now().Format(time.RFC3339Nano)+": "+format, args...)
}
}
Expand Down

0 comments on commit 2ad7011

Please sign in to comment.