diff --git a/addons.go b/addons.go index 1ddde4d7..e64379a7 100644 --- a/addons.go +++ b/addons.go @@ -2,13 +2,13 @@ package scalingo import ( "encoding/json" - "io/ioutil" + "io" "strconv" "time" - "github.com/Scalingo/go-scalingo/v4/http" - "gopkg.in/errgo.v1" + + "github.com/Scalingo/go-scalingo/v4/http" ) type AddonsService interface { @@ -169,7 +169,7 @@ func (c *Client) AddonLogsArchives(app, addonID string, page int) (*LogsArchives return nil, errgo.Notef(err, "fail to get log archives") } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return nil, errgo.Notef(err, "fail to read body of response") } diff --git a/auth_mock.go b/auth_mock.go index 7c546a81..f13501ed 100644 --- a/auth_mock.go +++ b/auth_mock.go @@ -3,14 +3,15 @@ package scalingo import ( "bytes" "fmt" - "io/ioutil" + "io" "net/http" "time" + "github.com/golang-jwt/jwt/v4" + "github.com/golang/mock/gomock" + httpclient "github.com/Scalingo/go-scalingo/v4/http" "github.com/Scalingo/go-scalingo/v4/http/httpmock" - jwt "github.com/golang-jwt/jwt/v4" - gomock "github.com/golang/mock/gomock" ) func MockAuth(ctrl *gomock.Controller) *httpmock.MockClient { @@ -27,7 +28,7 @@ func MockAuth(ctrl *gomock.Controller) *httpmock.MockClient { } return &http.Response{ - Body: ioutil.NopCloser(bytes.NewBuffer([]byte(fmt.Sprintf(`{"token": "%v"}`, jwt)))), + Body: io.NopCloser(bytes.NewBuffer([]byte(fmt.Sprintf(`{"token": "%v"}`, jwt)))), }, nil }).AnyTimes() return mock diff --git a/http/api_request.go b/http/api_request.go index a0b4aafc..1ef98368 100644 --- a/http/api_request.go +++ b/http/api_request.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "reflect" @@ -145,7 +144,7 @@ func (c *client) doRequest(req *http.Request) (*http.Response, error) { } func parseJSON(res *http.Response, data interface{}) error { - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { reqErr := fmt.Sprintf("%v %v", res.Request.Method, res.Request.URL) return errgo.Newf("fail to read body of request %v: %v", reqErr, err) diff --git a/logs-archives.go b/logs-archives.go index c8fa18fa..e960b047 100644 --- a/logs-archives.go +++ b/logs-archives.go @@ -2,7 +2,7 @@ package scalingo import ( "encoding/json" - "io/ioutil" + "io" "strconv" "gopkg.in/errgo.v1" @@ -43,7 +43,7 @@ func (c *Client) LogsArchivesByCursor(app string, cursor string) (*LogsArchivesR return nil, errgo.Mask(err) } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return nil, errgo.Mask(err) } @@ -74,7 +74,7 @@ func (c *Client) LogsArchives(app string, page int) (*LogsArchivesResponse, erro return nil, errgo.Mask(err) } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return nil, errgo.Mask(err) }