all: Remove deprecated io/ioutil package
Porting everything to the newer imports was trivial except for one instance which required a very small refactor.
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -148,7 +147,7 @@ func (obj *MountRes) Validate() error {
|
||||
}
|
||||
|
||||
// validate type
|
||||
fs, err := ioutil.ReadFile(procFilesystems)
|
||||
fs, err := os.ReadFile(procFilesystems)
|
||||
if err != nil {
|
||||
return errwrap.Wrapf(err, "error reading %s", procFilesystems)
|
||||
}
|
||||
@@ -517,7 +516,7 @@ func (obj *MountRes) fstabWrite(file string, mounts fstab.Mounts) error {
|
||||
contents := fmt.Sprintf("# Generated by %s at %d", obj.init.Program, time.Now().UnixNano()) + "\n"
|
||||
contents = contents + mounts.String() + "\n"
|
||||
// write the file
|
||||
if err := ioutil.WriteFile(file, []byte(contents), fstabUmask); err != nil {
|
||||
if err := os.WriteFile(file, []byte(contents), fstabUmask); err != nil {
|
||||
return errwrap.Wrapf(err, "error writing fstab file: %s", file)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user