io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os

This commit is contained in:
ahrtr
2021-10-30 06:41:02 +08:00
parent 2d0fa78f2f
commit fe95aa614c
96 changed files with 250 additions and 297 deletions

View File

@@ -27,7 +27,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"math/rand"
"os"
@@ -260,7 +259,7 @@ func validateSystem() error {
}
func maskLocksmithdOnCoreos() {
data, err := ioutil.ReadFile("/etc/os-release")
data, err := os.ReadFile("/etc/os-release")
if err != nil {
// Not all distros contain this file.
klog.Infof("Could not read /etc/os-release: %v", err)
@@ -350,7 +349,7 @@ func getAPIServerClient() (*clientset.Clientset, error) {
// loadSystemSpecFromFile returns the system spec from the file with the
// filename.
func loadSystemSpecFromFile(filename string) (*system.SysSpec, error) {
b, err := ioutil.ReadFile(filename)
b, err := os.ReadFile(filename)
if err != nil {
return nil, err
}