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:
@@ -1,7 +1,6 @@
|
||||
package systemstatsmonitor
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@@ -48,12 +47,8 @@ func newFakeInt64Metric(metricID metrics.MetricID, viewName string, description
|
||||
// testCollectAux is a test auxiliary function used for testing netCollector.Collect
|
||||
func testCollectAux(t *testing.T, name string, excludeInterfaceRegexp ssmtypes.NetStatsInterfaceRegexp, validate func(*testing.T, *netCollector)) {
|
||||
// mkdir /tmp/proc-X
|
||||
procDir, err := ioutil.TempDir(os.TempDir(), "proc-")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create temp proc directory: %v", err)
|
||||
}
|
||||
// rm -r /tmp/proc-X
|
||||
defer os.RemoveAll(procDir)
|
||||
procDir := t.TempDir()
|
||||
|
||||
// mkdir -C /tmp/proc-X/net
|
||||
procNetDir := path.Join(procDir, "net")
|
||||
if err := os.Mkdir(procNetDir, 0777); err != nil {
|
||||
|
||||
@@ -15,7 +15,7 @@ package systemstatsmonitor
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -102,7 +102,7 @@ func (ofc *osFeatureCollector) recordFeaturesFromCmdline(cmdlineArgs []system.Cm
|
||||
func (ofc *osFeatureCollector) recordFeaturesFromModules(modules []system.Module) {
|
||||
// Collect known modules (default modules based on guest OS present in known-modules.json)
|
||||
var knownModules []system.Module
|
||||
f, err := ioutil.ReadFile(ofc.config.KnownModulesConfigPath)
|
||||
f, err := os.ReadFile(ofc.config.KnownModulesConfigPath)
|
||||
if err != nil {
|
||||
glog.Warningf("Failed to read configuration file %s: %v",
|
||||
ofc.config.KnownModulesConfigPath, err)
|
||||
|
||||
@@ -18,7 +18,7 @@ package systemstatsmonitor
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
@@ -58,7 +58,7 @@ func NewSystemStatsMonitorOrDie(configPath string) types.Monitor {
|
||||
}
|
||||
|
||||
// Apply configurations.
|
||||
f, err := ioutil.ReadFile(configPath)
|
||||
f, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to read configuration file %q: %v", configPath, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user