cleanup: use os.WriteFile to write files

as ioutil.WriteFile is deprecated and
suggestion is to use os.WriteFile 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 14:58:27 +05:30
committed by mergify[bot]
parent 15ed9709d4
commit 562dff0d19
6 changed files with 17 additions and 20 deletions

View File

@ -1625,7 +1625,7 @@ func stashRBDImageMetadata(volOptions *rbdVolume, metaDataPath string) error {
}
fPath := filepath.Join(metaDataPath, stashFileName)
err = ioutil.WriteFile(fPath, encodedBytes, 0o600)
err = os.WriteFile(fPath, encodedBytes, 0o600)
if err != nil {
return fmt.Errorf("failed to stash JSON image metadata for image (%s) at path (%s): %w", volOptions, fPath, err)
}
@ -1673,7 +1673,7 @@ func updateRBDImageMetadataStash(metaDataPath, device string) error {
}
fPath := filepath.Join(metaDataPath, stashFileName)
err = ioutil.WriteFile(fPath, encodedBytes, 0600)
err = os.WriteFile(fPath, encodedBytes, 0600)
if err != nil {
return fmt.Errorf("failed to stash JSON image metadata at path: (%s) for spec:(%s) : %w",
fPath, imgMeta.String(), err)