refactor(plugins): replace deprecated io/ioutil functions

The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun committed 2023-12-22 01:59:22 +08:00
1 parent e6953d60e9
commit 1d186a5a81
16 files changed
+32 -41

No files matched your search

+2 -3
View File
@@ -4,7 +4,6 @@ import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -115,7 +114,7 @@ func PropertyGetAll(pluginName string, appName string) (map[string]string, error
return properties, errors.New("Specified property path is not a directory")
}
files, err := ioutil.ReadDir(pluginAppConfigRoot)
files, err := os.ReadDir(pluginAppConfigRoot)
if err != nil {
return properties, err
}
@@ -139,7 +138,7 @@ func PropertyGetDefault(pluginName, appName, property, defaultValue string) (val
}
propertyPath := getPropertyPath(pluginName, appName, property)
b, err := ioutil.ReadFile(propertyPath)
b, err := os.ReadFile(propertyPath)
if err != nil {
LogWarn(fmt.Sprintf("Unable to read %s property %s.%s", pluginName, appName, property))
return