Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 14, 2023
1 parent 3f9d9c3 commit dcf7be1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions internal/databases/postgres/wal_restore_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -195,7 +194,7 @@ func timelineWithSegmentNoSliceToMap(slice []*TimelineWithSegmentNo) map[uint32]
// getDirectoryFilenames returns slice of filenames in directory by path
func getDirectoryFilenames(path string) ([]string, error) {
result := make([]string, 0)
files, err := ioutil.ReadDir(path)
files, err := os.ReadDir(path)
if err != nil {
return nil, err
}
Expand Down
5 changes: 2 additions & 3 deletions internal/databases/postgres/walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/sha256"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -197,12 +196,12 @@ func extract(t *testing.T, dir string) string {
// initial bytes are the same.
func compare(t *testing.T, dir1, dir2 string) bool {
// ReadDir returns directory by filename.
files1, err := ioutil.ReadDir(dir1)
files1, err := os.ReadDir(dir1)
if err != nil {
t.Log(err)
}

files2, err := ioutil.ReadDir(dir2)
files2, err := os.ReadDir(dir2)
if err != nil {
t.Log(err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/storages/fs/folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package fs
import (
"fmt"
"io"
"io/ioutil"
"os"
"path"

Expand Down Expand Up @@ -43,7 +42,7 @@ func (folder *Folder) GetPath() string {
}

func (folder *Folder) ListFolder() (objects []storage.Object, subFolders []storage.Folder, err error) {
files, err := ioutil.ReadDir(path.Join(folder.rootPath, folder.subpath))
files, err := os.ReadDir(path.Join(folder.rootPath, folder.subpath))
if err != nil {
return nil, nil, NewError(err, "Unable to read folder")
}
Expand All @@ -53,7 +52,8 @@ func (folder *Folder) ListFolder() (objects []storage.Object, subFolders []stora
subPath := path.Join(folder.subpath, fileInfo.Name()) + "/"
subFolders = append(subFolders, NewFolder(folder.rootPath, subPath))
} else {
objects = append(objects, storage.NewLocalObject(fileInfo.Name(), fileInfo.ModTime(), fileInfo.Size()))
info, _ := fileInfo.Info()
objects = append(objects, storage.NewLocalObject(fileInfo.Name(), info.ModTime(), info.Size()))
}
}
return
Expand Down
3 changes: 1 addition & 2 deletions tests_func/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bufio"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -73,7 +72,7 @@ func SplitEnvLine(line string) (string, string) {
}

func CopyDirectory(src, dest string, filter string) error {
entries, err := ioutil.ReadDir(src)
entries, err := os.ReadDir(src)
if err != nil {
return err
}
Expand Down

0 comments on commit dcf7be1

Please sign in to comment.