diff options
| author | Eng Zer Jun <engzerjun@gmail.com> | 2021-10-14 12:27:58 +0800 |
|---|---|---|
| committer | Eng Zer Jun <engzerjun@gmail.com> | 2021-10-14 12:27:58 +0800 |
| commit | a23bcbb7ecf93fcda35976f4f2fb42a67830e718 (patch) | |
| tree | 3227e82e51346dad8649a17e991c9cf561ef8071 /weed/storage/disk_location_ec.go | |
| parent | 4cbd390fbe634e2370c36a61b1574e9d648c3cee (diff) | |
| download | seaweedfs-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/disk_location_ec.go')
| -rw-r--r-- | weed/storage/disk_location_ec.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index 91c7d86a6..3f56d797b 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -2,7 +2,6 @@ package storage import ( "fmt" - "io/ioutil" "os" "path" "regexp" @@ -118,25 +117,25 @@ func (l *DiskLocation) loadEcShards(shards []string, collection string, vid need func (l *DiskLocation) loadAllEcShards() (err error) { - fileInfos, err := ioutil.ReadDir(l.Directory) + dirEntries, err := os.ReadDir(l.Directory) if err != nil { return fmt.Errorf("load all ec shards in dir %s: %v", l.Directory, err) } if l.IdxDirectory != l.Directory { - indexFileInfos, err := ioutil.ReadDir(l.IdxDirectory) + indexDirEntries, err := os.ReadDir(l.IdxDirectory) if err != nil { return fmt.Errorf("load all ec shards in dir %s: %v", l.IdxDirectory, err) } - fileInfos = append(fileInfos, indexFileInfos...) + dirEntries = append(dirEntries, indexDirEntries...) } - sort.Slice(fileInfos, func(i, j int) bool { - return fileInfos[i].Name() < fileInfos[j].Name() + sort.Slice(dirEntries, func(i, j int) bool { + return dirEntries[i].Name() < dirEntries[j].Name() }) var sameVolumeShards []string var prevVolumeId needle.VolumeId - for _, fileInfo := range fileInfos { + for _, fileInfo := range dirEntries { if fileInfo.IsDir() { continue } |
