diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb576061..87533d93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [1.13, 1.14, 1.15, 1.16, 1.17, 1.18] + go-version: [1.17, 1.18, 1.19] steps: - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4bf88c1..69e16b3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/hcloud/client.go b/hcloud/client.go index 04ddaec7..3e6a4428 100644 --- a/hcloud/client.go +++ b/hcloud/client.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "net/http" "net/http/httputil" @@ -222,7 +221,7 @@ func (c *Client) Do(r *http.Request, v interface{}) (*Response, error) { var body []byte var err error if r.ContentLength > 0 { - body, err = ioutil.ReadAll(r.Body) + body, err = io.ReadAll(r.Body) if err != nil { r.Body.Close() return nil, err @@ -231,7 +230,7 @@ func (c *Client) Do(r *http.Request, v interface{}) (*Response, error) { } for { if r.ContentLength > 0 { - r.Body = ioutil.NopCloser(bytes.NewReader(body)) + r.Body = io.NopCloser(bytes.NewReader(body)) } if c.debugWriter != nil { @@ -247,13 +246,13 @@ func (c *Client) Do(r *http.Request, v interface{}) (*Response, error) { return nil, err } response := &Response{Response: resp} - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { resp.Body.Close() return response, err } 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) diff --git a/hcloud/client_test.go b/hcloud/client_test.go index 5c025fcf..7e2b3f22 100644 --- a/hcloud/client_test.go +++ b/hcloud/client_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -304,7 +304,7 @@ func TestClientDoPost(t *testing.T) { callCount++ w.Header().Set("Content-Type", "application/json") var dat map[string]interface{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() if err != nil { t.Error(err) diff --git a/hcloud/metadata/client.go b/hcloud/metadata/client.go index a95fb10d..7bfa18e5 100644 --- a/hcloud/metadata/client.go +++ b/hcloud/metadata/client.go @@ -2,7 +2,7 @@ package metadata import ( "fmt" - "io/ioutil" + "io" "net" "net/http" "strconv" @@ -73,7 +73,7 @@ func (c *Client) get(path string) (string, error) { return "", err } defer resp.Body.Close() - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { return "", err }