Merge pull request #822 from gy95/ioutil

replace deprecated package io/ioutil with packages io and os
This commit is contained in:
karmada-bot 2021-10-16 12:17:58 +08:00 committed by GitHub
commit e55ed1e220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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
}