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:
@@ -3,7 +3,7 @@ package plugins
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -30,7 +30,7 @@ func (cr *configReaderImpl) readConfig(ctx context.Context, path string) ([]*plu
|
||||
var apps []*pluginsAsConfig
|
||||
cr.log.Debug("Looking for plugin provisioning files", "path", path)
|
||||
|
||||
files, err := ioutil.ReadDir(path)
|
||||
files, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
cr.log.Error("Failed to read plugin provisioning files from directory", "path", path, "error", err)
|
||||
return apps, nil
|
||||
@@ -65,7 +65,7 @@ func (cr *configReaderImpl) readConfig(ctx context.Context, path string) ([]*plu
|
||||
return apps, nil
|
||||
}
|
||||
|
||||
func (cr *configReaderImpl) parsePluginConfig(path string, file os.FileInfo) (*pluginsAsConfig, error) {
|
||||
func (cr *configReaderImpl) parsePluginConfig(path string, file fs.DirEntry) (*pluginsAsConfig, error) {
|
||||
filename, err := filepath.Abs(filepath.Join(path, file.Name()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user