mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
remove the dependency on the deprecated io/ioutil
Reference: https://go.dev/doc/go1.16#ioutil Signed-off-by: Benjamin Wang <wachao@vmware.com>
This commit is contained in:
parent
bd9f1584d4
commit
5ef713c728
@ -18,7 +18,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -33,11 +32,15 @@ import (
|
|||||||
|
|
||||||
func readRaw(fromIndex *uint64, waldir string, out io.Writer) {
|
func readRaw(fromIndex *uint64, waldir string, out io.Writer) {
|
||||||
var walReaders []fileutil.FileReader
|
var walReaders []fileutil.FileReader
|
||||||
files, err := ioutil.ReadDir(waldir)
|
dirEntry, err := os.ReadDir(waldir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error: Failed to read directory '%s' error:%v", waldir, err)
|
log.Fatalf("Error: Failed to read directory '%s' error:%v", waldir, err)
|
||||||
}
|
}
|
||||||
for _, finfo := range files {
|
for _, e := range dirEntry {
|
||||||
|
finfo, err := e.Info()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error: failed to get fileInfo of file: %s, error: %v", e.Name(), err)
|
||||||
|
}
|
||||||
if filepath.Ext(finfo.Name()) != ".wal" {
|
if filepath.Ext(finfo.Name()) != ".wal" {
|
||||||
log.Printf("Warning: Ignoring not .wal file: %s", finfo.Name())
|
log.Printf("Warning: Ignoring not .wal file: %s", finfo.Name())
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user