1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-25 14:48:06 +00:00

Replace deprecated io/ioutil

Signed-off-by: Manuel Buil <mbuil@suse.com>
This commit is contained in:
Manuel Buil
2023-08-04 13:01:50 +02:00
parent d80fc55b60
commit f923a49d9d
15 changed files with 42 additions and 49 deletions

View File

@@ -3,7 +3,7 @@ package cmd
import (
"context"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"strings"
@@ -40,7 +40,7 @@ func resolveClusterFile(ctx *cli.Context) (string, string, error) {
return "", "", fmt.Errorf("can not find cluster configuration file: %v", err)
}
defer file.Close()
buf, err := ioutil.ReadAll(file)
buf, err := io.ReadAll(file)
if err != nil {
return "", "", fmt.Errorf("failed to read file: %v", err)
}

View File

@@ -4,7 +4,6 @@ import (
"bufio"
"context"
"fmt"
"io/ioutil"
"os"
"reflect"
"strconv"
@@ -97,7 +96,7 @@ func writeConfig(cluster *v3.RancherKubernetesEngineConfig, configFile string, p
fmt.Printf("Configuration File: \n%s", configString)
return nil
}
return ioutil.WriteFile(configFile, []byte(configString), 0640)
return os.WriteFile(configFile, []byte(configString), 0640)
}
func clusterConfig(ctx *cli.Context) error {