io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os

This commit is contained in:
ahrtr
2021-10-30 06:41:02 +08:00
parent 2d0fa78f2f
commit fe95aa614c
96 changed files with 250 additions and 297 deletions

View File

@@ -20,7 +20,7 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"io"
"net"
"os"
"os/exec"
@@ -104,7 +104,7 @@ func RunCustomEtcd(dataDir string, customFlags []string) (url string, stopFn fun
klog.Infof("starting etcd on %s", customURL)
etcdDataDir, err := ioutil.TempDir(os.TempDir(), dataDir)
etcdDataDir, err := os.MkdirTemp(os.TempDir(), dataDir)
if err != nil {
return "", nil, fmt.Errorf("unable to make temp etcd data dir %s: %v", dataDir, err)
}
@@ -139,7 +139,7 @@ func RunCustomEtcd(dataDir string, customFlags []string) (url string, stopFn fun
// Quiet etcd logs for integration tests
// Comment out to get verbose logs if desired
grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, os.Stderr))
grpclog.SetLoggerV2(grpclog.NewLoggerV2(io.Discard, io.Discard, os.Stderr))
if err := cmd.Start(); err != nil {
return "", nil, fmt.Errorf("failed to run etcd: %v", err)