mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +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
@ -21,7 +21,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@ -244,7 +243,7 @@ func GetKrbdSupportedFeatures() (string, error) {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
val, err := ioutil.ReadFile(krbdSupportedFeaturesFile)
|
||||
val, err := os.ReadFile(krbdSupportedFeaturesFile)
|
||||
if err != nil {
|
||||
log.ErrorLogMsg("reading file %q failed: %v", krbdSupportedFeaturesFile, err)
|
||||
|
||||
@ -1638,7 +1637,7 @@ func lookupRBDImageMetadataStash(metaDataPath string) (rbdImageMetadataStash, er
|
||||
var imgMeta rbdImageMetadataStash
|
||||
|
||||
fPath := filepath.Join(metaDataPath, stashFileName)
|
||||
encodedBytes, err := ioutil.ReadFile(fPath) // #nosec - intended reading from fPath
|
||||
encodedBytes, err := os.ReadFile(fPath) // #nosec - intended reading from fPath
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return imgMeta, fmt.Errorf("failed to read stashed JSON image metadata from path (%s): %w", fPath, err)
|
||||
|
Reference in New Issue
Block a user