chore: io/ioutil deprecated

This commit is contained in:
guoguangwu 2023-06-02 11:11:07 +08:00
parent c47fa95d93
commit 58751405a6

View File

@ -20,7 +20,6 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"strings" "strings"
@ -205,7 +204,7 @@ func (f *NodeClient) NodePublishVolume(ctx context.Context, req *csipb.NodePubli
// "Creation of target_path is the responsibility of the SP." // "Creation of target_path is the responsibility of the SP."
// Our plugin depends on it. // Our plugin depends on it.
if req.VolumeCapability.GetBlock() != nil { if req.VolumeCapability.GetBlock() != nil {
if err := ioutil.WriteFile(req.TargetPath, []byte{}, 0644); err != nil { if err := os.WriteFile(req.TargetPath, []byte{}, 0644); err != nil {
return nil, fmt.Errorf("cannot create target path %s for block file: %s", req.TargetPath, err) return nil, fmt.Errorf("cannot create target path %s for block file: %s", req.TargetPath, err)
} }
} else { } else {