Remove ioutil from component-helpers

Signed-off-by: inosato <si17_21@yahoo.co.jp>
This commit is contained in:
inosato 2022-07-30 21:13:19 +09:00
parent 3902a53419
commit c5ce76e712

View File

@ -17,7 +17,7 @@ limitations under the License.
package sysctl package sysctl
import ( import (
"io/ioutil" "os"
"path" "path"
"strconv" "strconv"
"strings" "strings"
@ -83,7 +83,7 @@ type procSysctl struct {
// GetSysctl returns the value for the specified sysctl setting // GetSysctl returns the value for the specified sysctl setting
func (*procSysctl) GetSysctl(sysctl string) (int, error) { func (*procSysctl) GetSysctl(sysctl string) (int, error) {
data, err := ioutil.ReadFile(path.Join(sysctlBase, sysctl)) data, err := os.ReadFile(path.Join(sysctlBase, sysctl))
if err != nil { if err != nil {
return -1, err return -1, err
} }
@ -96,5 +96,5 @@ func (*procSysctl) GetSysctl(sysctl string) (int, error) {
// SetSysctl modifies the specified sysctl flag to the new value // SetSysctl modifies the specified sysctl flag to the new value
func (*procSysctl) SetSysctl(sysctl string, newVal int) error { func (*procSysctl) SetSysctl(sysctl string, newVal int) error {
return ioutil.WriteFile(path.Join(sysctlBase, sysctl), []byte(strconv.Itoa(newVal)), 0640) return os.WriteFile(path.Join(sysctlBase, sysctl), []byte(strconv.Itoa(newVal)), 0640)
} }