cleanup: use os.ReadFile to read file

as ioutil.ReadFile is deprecated and
suggestion is to use os.ReadFile as
per https://pkg.go.dev/io/ioutil updating
the same.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-01-21 15:02:34 +05:30
committed by mergify[bot]
parent 562dff0d19
commit aba6979d29
10 changed files with 17 additions and 23 deletions

View File

@ -19,7 +19,6 @@ package e2e
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"sync"
@ -79,7 +78,7 @@ func deleteCephfsPlugin() {
}
func createORDeleteCephfsResources(action kubectlAction) {
csiDriver, err := ioutil.ReadFile(cephFSDirPath + csiDriverObject)
csiDriver, err := os.ReadFile(cephFSDirPath + csiDriverObject)
if err != nil {
// createORDeleteRbdResources is used for upgrade testing as csidriverObject is
// newly added, discarding file not found error.
@ -92,7 +91,7 @@ func createORDeleteCephfsResources(action kubectlAction) {
e2elog.Failf("failed to %s CSIDriver object: %v", action, err)
}
}
cephConf, err := ioutil.ReadFile(examplePath + cephConfconfigMap)
cephConf, err := os.ReadFile(examplePath + cephConfconfigMap)
if err != nil {
// createORDeleteCephfsResources is used for upgrade testing as cephConfConfigmap is
// newly added, discarding file not found error.