linter fixes

This commit is contained in:
ston1th 2021-11-07 11:57:25 +01:00
commit ffb356182e
4 changed files with 8 additions and 11 deletions

View file

@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httputil"
@ -37,7 +36,7 @@ func ExponentialBackoff(b float64, d time.Duration) BackoffFunc {
*/
type Client struct {
sync.Mutex
mu sync.Mutex
endpoints []string
username string
password string
@ -231,8 +230,8 @@ func (c *Client) Auth() (err error) {
if !time.Now().After(c.session.Time) {
return
}
c.Lock()
defer c.Unlock()
c.mu.Lock()
defer c.mu.Unlock()
if !time.Now().After(c.session.Time) {
return
}
@ -289,13 +288,13 @@ func (c *Client) Do(r *http.Request, v interface{}) (resp *http.Response, err er
if err != nil {
return
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
resp.Body.Close()
return
}
resp.Body.Close()
resp.Body = ioutil.NopCloser(bytes.NewReader(body))
resp.Body = io.NopCloser(bytes.NewReader(body))
if c.debugWriter != nil {
dumpResp, err := httputil.DumpResponse(resp, true)