aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_info
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2021-10-14 12:27:58 +0800
committerEng Zer Jun <engzerjun@gmail.com>2021-10-14 12:27:58 +0800
commita23bcbb7ecf93fcda35976f4f2fb42a67830e718 (patch)
tree3227e82e51346dad8649a17e991c9cf561ef8071 /weed/storage/volume_info
parent4cbd390fbe634e2370c36a61b1574e9d648c3cee (diff)
downloadseaweedfs-a23bcbb7ecf93fcda35976f4f2fb42a67830e718.tar.xz
seaweedfs-a23bcbb7ecf93fcda35976f4f2fb42a67830e718.zip
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Diffstat (limited to 'weed/storage/volume_info')
-rw-r--r--weed/storage/volume_info/volume_info.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/weed/storage/volume_info/volume_info.go b/weed/storage/volume_info/volume_info.go
index b7ef75171..fa906e1d4 100644
--- a/weed/storage/volume_info/volume_info.go
+++ b/weed/storage/volume_info/volume_info.go
@@ -3,15 +3,14 @@ package volume_info
import (
"bytes"
"fmt"
- "io/ioutil"
-
- _ "github.com/chrislusf/seaweedfs/weed/storage/backend/s3_backend"
- "github.com/chrislusf/seaweedfs/weed/util"
+ "os"
"github.com/golang/protobuf/jsonpb"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
+ _ "github.com/chrislusf/seaweedfs/weed/storage/backend/s3_backend"
+ "github.com/chrislusf/seaweedfs/weed/util"
)
// MaybeLoadVolumeInfo load the file data as *volume_server_pb.VolumeInfo, the returned volumeInfo will not be nil
@@ -36,7 +35,7 @@ func MaybeLoadVolumeInfo(fileName string) (volumeInfo *volume_server_pb.VolumeIn
hasVolumeInfoFile = true
glog.V(1).Infof("maybeLoadVolumeInfo reads %s", fileName)
- tierData, readErr := ioutil.ReadFile(fileName)
+ tierData, readErr := os.ReadFile(fileName)
if readErr != nil {
glog.Warningf("fail to read %s : %v", fileName, readErr)
err = fmt.Errorf("fail to read %s : %v", fileName, readErr)
@@ -76,7 +75,7 @@ func SaveVolumeInfo(fileName string, volumeInfo *volume_server_pb.VolumeInfo) er
return fmt.Errorf("marshal to %s: %v", fileName, marshalErr)
}
- writeErr := ioutil.WriteFile(fileName, []byte(text), 0755)
+ writeErr := os.WriteFile(fileName, []byte(text), 0755)
if writeErr != nil {
return fmt.Errorf("fail to write %s : %v", fileName, writeErr)
}