mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
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:
committed by
mergify[bot]
parent
562dff0d19
commit
aba6979d29
@ -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.
|
||||
|
@ -19,7 +19,7 @@ package e2e
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -87,7 +87,7 @@ func deleteNamespace(c kubernetes.Interface, name string) error {
|
||||
}
|
||||
|
||||
func replaceNamespaceInTemplate(filePath string) (string, error) {
|
||||
read, err := ioutil.ReadFile(filePath)
|
||||
read, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
@ -120,7 +119,7 @@ func deleteRBDPlugin() {
|
||||
}
|
||||
|
||||
func createORDeleteRbdResources(action kubectlAction) {
|
||||
csiDriver, err := ioutil.ReadFile(rbdDirPath + csiDriverObject)
|
||||
csiDriver, err := os.ReadFile(rbdDirPath + csiDriverObject)
|
||||
if err != nil {
|
||||
// createORDeleteRbdResources is used for upgrade testing as csidriverObject is
|
||||
// newly added, discarding file not found error.
|
||||
@ -133,7 +132,7 @@ func createORDeleteRbdResources(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 {
|
||||
// createORDeleteRbdResources is used for upgrade testing as cephConf Configmap is
|
||||
// newly added, discarding file not found error.
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -160,7 +160,7 @@ func deleteResource(scPath string) error {
|
||||
}
|
||||
|
||||
func unmarshal(fileName string, obj interface{}) error {
|
||||
f, err := ioutil.ReadFile(fileName)
|
||||
f, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user