chore: remove refs to deprecated io/ioutil

This commit is contained in:
guoguangwu
2023-06-21 12:12:27 +08:00
parent 339e243472
commit 6dc23ca804
15 changed files with 36 additions and 43 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ limitations under the License.
package makers
import (
"io/ioutil"
"os"
"github.com/golang/glog"
)
@@ -30,7 +30,7 @@ const ext4ErrorTrigger = "/sys/fs/ext4/sda1/trigger_fs_error"
func makeFilesystemError() {
msg := []byte("fake filesystem error from problem-maker")
err := ioutil.WriteFile(ext4ErrorTrigger, msg, 0200)
err := os.WriteFile(ext4ErrorTrigger, msg, 0200)
if err != nil {
glog.Fatalf("Failed writing log to %q: %v", ext4ErrorTrigger, err)
}
+2 -2
View File
@@ -17,7 +17,7 @@ limitations under the License.
package makers
import (
"io/ioutil"
"os"
"strings"
"github.com/golang/glog"
@@ -38,7 +38,7 @@ Killed process 1012 (heapster) total-vm:327128kB, anon-rss:306328kB, file-rss:11
func writeKernelMessageOrDie(msg string) {
for _, line := range strings.Split(msg, "\n") {
err := ioutil.WriteFile(kmsgPath, []byte(line), 0644)
err := os.WriteFile(kmsgPath, []byte(line), 0644)
if err != nil {
glog.Fatalf("Failed writing to %q: %v", kmsgPath, err)
}