Remove ioutil (#181)
In 1.16, it's now deprecated and replaced by `io` and `os`. Let's upgrade! Test plan: - make check - git grep ioutil
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -29,13 +29,13 @@ func (t *lastResponseTransport) RoundTrip(req *http.Request) (*http.Response, er
|
||||
return resp, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return resp, fmt.Errorf("roundtrip failed: unreadable body: %w", err)
|
||||
}
|
||||
t.lastResponseBody = body
|
||||
// Restore the body for the next reader:
|
||||
resp.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
resp.Body = io.NopCloser(bytes.NewBuffer(body))
|
||||
return resp, err
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package integration
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -42,7 +41,7 @@ func RunGenerateTest(t *testing.T, relConfigFilename string) {
|
||||
}
|
||||
|
||||
for filename, content := range generated {
|
||||
expectedContent, err := ioutil.ReadFile(filename)
|
||||
expectedContent, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user