refactor: move from io/ioutil to io and os packages (#5266)
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:
@@ -19,7 +19,7 @@ package routers
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -170,7 +170,7 @@ func (c *routerOperator) getRouterService(namespace string) (*corev1.Service, er
|
||||
// Load all resource yamls
|
||||
func loadYamls() ([]string, error) {
|
||||
var yamls []string
|
||||
files, err := ioutil.ReadDir(ingressControllerFolder)
|
||||
files, err := os.ReadDir(ingressControllerFolder)
|
||||
if err != nil {
|
||||
klog.Warning(err)
|
||||
return nil, err
|
||||
@@ -180,7 +180,7 @@ func loadYamls() ([]string, error) {
|
||||
if file.IsDir() || !strings.HasSuffix(file.Name(), ".yaml") {
|
||||
continue
|
||||
}
|
||||
content, err := ioutil.ReadFile(ingressControllerFolder + "/" + file.Name())
|
||||
content, err := os.ReadFile(ingressControllerFolder + "/" + file.Name())
|
||||
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user