mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
all: use os.ReadDir instead of ioutil.ReadDir
The ioutil.ReadDir is deprecated since Go1.16 - see https://tip.golang.org/doc/go1.16#ioutil
VictoriaMetrics requires at least Go1.18, so it is time to switch from io.ReadDir to os.ReadDir
This is a follow-up for 02ca2342ab
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -221,14 +220,14 @@ func tryOpeningQueue(path, name string, chunkFileSize, maxBlockSize, maxPendingB
|
||||
}
|
||||
|
||||
// Locate reader and writer chunks in the path.
|
||||
fis, err := ioutil.ReadDir(path)
|
||||
des, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot read contents of the directory %q: %w", path, err)
|
||||
}
|
||||
for _, fi := range fis {
|
||||
fname := fi.Name()
|
||||
for _, de := range des {
|
||||
fname := de.Name()
|
||||
filepath := path + "/" + fname
|
||||
if fi.IsDir() {
|
||||
if de.IsDir() {
|
||||
logger.Errorf("skipping unknown directory %q", filepath)
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user