linter fixes

This commit is contained in:
ston1th 2021-11-07 13:30:22 +01:00
commit df5babf6c8
15 changed files with 49 additions and 55 deletions

View file

@ -7,19 +7,16 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httputil"
"os"
"strconv"
"strings"
"sync"
"time"
)
type Client struct {
sync.Mutex
endpoint string
username string
password string
@ -193,13 +190,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)

View file

@ -14,6 +14,10 @@ func (e Error) Error() string {
return e.Err
}
func (e Error) Is(target error) bool {
return e.Err == target.Error()
}
func decodeResp(resp *http.Response, v interface{}) error {
if resp.Body == nil {
return nil