mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 12:16:26 +00:00
chore: remove refs to deprecated io/ioutil
This commit is contained in:
@@ -16,7 +16,7 @@ limitations under the License.
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -121,7 +121,7 @@ func TestPrometheusMetricsParsingAndMatching(t *testing.T) {
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
b, err := ioutil.ReadFile(test.metricsTextPath)
|
||||
b, err := os.ReadFile(test.metricsTextPath)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error reading file %s: %v", test.metricsTextPath, err)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
"crypto/sha512"
|
||||
"encoding/hex"
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -92,7 +92,7 @@ func main() {
|
||||
if res.ContentLength != objectLength {
|
||||
log.Fatalf("Length reported (%d) is not equal to expected length (%d)", res.ContentLength, objectLength)
|
||||
}
|
||||
blobData, err := ioutil.ReadAll(res.Body)
|
||||
blobData, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatal("Failed to read full content", err)
|
||||
@@ -110,7 +110,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatalf("Failure (%s) while reading %s", err, objectHashUrl)
|
||||
}
|
||||
content, err := ioutil.ReadAll(res.Body)
|
||||
content, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
log.Fatal("Failed to read full content of hash file", err)
|
||||
|
||||
Reference in New Issue
Block a user