Remove ioutil.ReadDir from usage (#53550)

* add depguard rule for ioutil

* replace ioutil.ReadDir with os.ReadDir

* use legacy option in depguard supported in golangci-lint v1.40

* replace ioutil.ReadDir with os.ReadDir

* return error for file info
This commit is contained in:
Jo
2022-08-11 07:21:12 -04:00
committed by GitHub
parent b42f3e2c4c
commit ca72cd570e
18 changed files with 62 additions and 46 deletions
@@ -1,12 +1,13 @@
package commandstest
import (
"io/fs"
"os"
"time"
)
type FakeIoUtil struct {
FakeReadDir []os.FileInfo
FakeReadDir []fs.DirEntry
FakeIsDirectory bool
}
@@ -18,7 +19,7 @@ func (util *FakeIoUtil) RemoveAll(path string) error {
return nil
}
func (util *FakeIoUtil) ReadDir(path string) ([]os.FileInfo, error) {
func (util *FakeIoUtil) ReadDir(path string) ([]fs.DirEntry, error) {
return util.FakeReadDir, nil
}