go: update required version to be 1.17 and add 1.19 to CI (#7129)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
Joe Chen
2022-08-08 13:56:50 +08:00
committed by GitHub
parent cfa5ddbde8
commit a43b933c90
8 changed files with 99 additions and 41 deletions

View File

@@ -11,7 +11,6 @@ import (
"crypto/tls"
"encoding/xml"
"io"
"io/ioutil"
"log"
"mime/multipart"
"net"
@@ -199,9 +198,9 @@ func (r *Request) SetTransport(transport http.RoundTripper) *Request {
// example:
//
// func(req *http.Request) (*url.URL, error) {
// u, _ := url.ParseRequestURI("http://127.0.0.1:8118")
// return u, nil
// }
// u, _ := url.ParseRequestURI("http://127.0.0.1:8118")
// return u, nil
// }
func (r *Request) SetProxy(proxy func(*http.Request) (*url.URL, error)) *Request {
r.setting.Proxy = proxy
return r
@@ -225,11 +224,11 @@ func (r *Request) Body(data interface{}) *Request {
switch t := data.(type) {
case string:
bf := bytes.NewBufferString(t)
r.req.Body = ioutil.NopCloser(bf)
r.req.Body = io.NopCloser(bf)
r.req.ContentLength = int64(len(t))
case []byte:
bf := bytes.NewBuffer(t)
r.req.Body = ioutil.NopCloser(bf)
r.req.Body = io.NopCloser(bf)
r.req.ContentLength = int64(len(t))
}
return r
@@ -286,7 +285,7 @@ func (r *Request) getResponse() (*http.Response, error) {
_ = pw.Close()
}()
r.Header("Content-Type", bodyWriter.FormDataContentType())
r.req.Body = ioutil.NopCloser(pr)
r.req.Body = io.NopCloser(pr)
} else if len(paramBody) > 0 {
r.Header("Content-Type", "application/x-www-form-urlencoded")
r.Body(paramBody)
@@ -384,7 +383,7 @@ func (r *Request) Bytes() ([]byte, error) {
return nil, nil
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}