mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-02-14 18:09:57 +00:00
chore: remove refs to deprecated io/ioutil
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//go:build !disable_system_log_monitor
|
||||
// +build !disable_system_log_monitor
|
||||
|
||||
/*
|
||||
@@ -21,7 +22,6 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -91,14 +91,14 @@ func TestNPDMain(t *testing.T) {
|
||||
}
|
||||
|
||||
func writeTempFile(t *testing.T, ext string, contents string) (string, error) {
|
||||
f, err := ioutil.TempFile("", "*."+ext)
|
||||
f, err := os.CreateTemp("", "*."+ext)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot create temp file, %v", err)
|
||||
}
|
||||
|
||||
fileName := f.Name()
|
||||
|
||||
if err := ioutil.WriteFile(fileName, []byte(contents), 0644); err != nil {
|
||||
if err := os.WriteFile(fileName, []byte(contents), 0644); err != nil {
|
||||
os.Remove(fileName)
|
||||
return "", fmt.Errorf("cannot write config to temp file %s, %v", fileName, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user