From ab3f1761637b1eab596765d7ae6809e34043d003 Mon Sep 17 00:00:00 2001 From: guoyao <1015105054@qq.com> Date: Sat, 16 Oct 2021 11:50:36 +0800 Subject: [PATCH] replace deprecated package io/ioutil with packages io and os Signed-off-by: guoyao <1015105054@qq.com> --- pkg/clusterdiscovery/clusterapi/clusterapi.go | 4 ++-- test/e2e/suite_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/clusterdiscovery/clusterapi/clusterapi.go b/pkg/clusterdiscovery/clusterapi/clusterapi.go index e4b1f0ffe1dd..304eb219f186 100644 --- a/pkg/clusterdiscovery/clusterapi/clusterapi.go +++ b/pkg/clusterdiscovery/clusterapi/clusterapi.go @@ -3,7 +3,7 @@ package clusterapi import ( "context" "fmt" - "io/ioutil" + "os" "time" corev1 "k8s.io/api/core/v1" @@ -200,7 +200,7 @@ func (d *ClusterDetector) unJoinClusterAPICluster(clusterName string) error { func generateKubeconfigFile(clusterName string, kubeconfigData []byte) (string, error) { kubeconfigPath := fmt.Sprintf("/etc/%s.kubeconfig", clusterName) - err := ioutil.WriteFile(kubeconfigPath, kubeconfigData, 0600) + err := os.WriteFile(kubeconfigPath, kubeconfigData, 0600) if err != nil { klog.Errorf("Failed to write File %s: %v", kubeconfigPath, err) return "", err diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index a7337e79a66e..0625f62c2047 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -3,7 +3,7 @@ package e2e import ( "context" "fmt" - "io/ioutil" + "io" "os" "strings" "testing" @@ -373,7 +373,7 @@ func podLogs(ctx context.Context, k8s kubernetes.Interface, namespace, name stri return "", err } defer logs.Close() - data, err := ioutil.ReadAll(logs) + data, err := io.ReadAll(logs) if err != nil { return "", err }