cleanup deprecated package io/ioutil (#4920)

Signed-off-by: zounengren <zouyee1989@gmail.com>
This commit is contained in:
Zou Nengren
2021-10-13 15:30:31 +08:00
committed by GitHub
parent 44fcca0e0d
commit 5191959bd7
26 changed files with 53 additions and 72 deletions

View File

@@ -1,7 +1,6 @@
package test
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -10,7 +9,7 @@ import (
)
func setupProxyTargetCoreDNS(t *testing.T, fn func(string)) {
tmpdir, err := ioutil.TempDir(os.TempDir(), "coredns")
tmpdir, err := os.MkdirTemp(os.TempDir(), "coredns")
if err != nil {
t.Fatal(err)
}
@@ -24,7 +23,7 @@ google.com. IN A 172.217.25.110
`
path := filepath.Join(tmpdir, "file")
if err = ioutil.WriteFile(path, []byte(content), 0644); err != nil {
if err = os.WriteFile(path, []byte(content), 0644); err != nil {
t.Fatalf("Could not write to temp file: %s", err)
}
defer os.Remove(path)