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:
@@ -17,7 +17,7 @@ limitations under the License.
|
||||
package cluster
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
@@ -35,7 +35,7 @@ func buildKubeconfigFromRestConfig(config *rest.Config) ([]byte, error) {
|
||||
// generated kubeconfig will be used by cluster federation, CAFile is not
|
||||
// accepted by kubefed, so we need read CAFile
|
||||
if len(apiCluster.CertificateAuthorityData) == 0 && len(config.CAFile) != 0 {
|
||||
caData, err := ioutil.ReadFile(config.CAFile)
|
||||
caData, err := os.ReadFile(config.CAFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ limitations under the License.
|
||||
package helm
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@@ -73,8 +73,8 @@ var _ = Context("Helm reconcier", func() {
|
||||
Describe("Gateway", func() {
|
||||
It("Should setup gateway helm reconcier", func() {
|
||||
data := "- group: gateway.kubesphere.io\n version: v1alpha1\n kind: Gateway\n chart: ../../../config/gateway\n"
|
||||
f, _ := ioutil.TempFile("", "watch")
|
||||
ioutil.WriteFile(f.Name(), []byte(data), 0)
|
||||
f, _ := os.CreateTemp("", "watch")
|
||||
os.WriteFile(f.Name(), []byte(data), 0)
|
||||
|
||||
mgr, err := ctrl.NewManager(cfg, ctrl.Options{MetricsBindAddress: "0"})
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to create a manager")
|
||||
|
||||
Reference in New Issue
Block a user