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

View File

@@ -18,7 +18,7 @@ package systemlogmonitor
import (
"encoding/json"
"io/ioutil"
"os"
"time"
"github.com/golang/glog"
@@ -62,7 +62,7 @@ func NewLogMonitorOrDie(configPath string) types.Monitor {
tomb: tomb.NewTomb(),
}
f, err := ioutil.ReadFile(configPath)
f, err := os.ReadFile(configPath)
if err != nil {
glog.Fatalf("Failed to read configuration file %q: %v", configPath, err)
}

View File

@@ -17,7 +17,6 @@ limitations under the License.
package filelog
import (
"io/ioutil"
"os"
"testing"
"time"
@@ -139,7 +138,7 @@ Jan 2 03:04:05 kernel: [2.000000] 3
}
for c, test := range testCases {
t.Logf("TestCase #%d: %#v", c+1, test)
f, err := ioutil.TempFile("", "log_watcher_test")
f, err := os.CreateTemp("", "log_watcher_test")
assert.NoError(t, err)
defer func() {
f.Close()