multi: replace ioutil.ReadDir

This commit is contained in:
erik 2023-06-14 11:43:51 +02:00 committed by ErikEk
parent c7f81d3142
commit caf2419ff6
3 changed files with 3 additions and 5 deletions

View File

@ -7,7 +7,6 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"strings" "strings"
@ -135,7 +134,7 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
// the log files, including any compressed log files from // the log files, including any compressed log files from
// logrorate, before deleting the temporary log dir. // logrorate, before deleting the temporary log dir.
logDir := fmt.Sprintf("%s/%s", baseLogDir, netParams.Name) logDir := fmt.Sprintf("%s/%s", baseLogDir, netParams.Name)
files, err := ioutil.ReadDir(logDir) files, err := os.ReadDir(logDir)
if err != nil { if err != nil {
errStr += fmt.Sprintf( errStr += fmt.Sprintf(
"unable to read log directory: %v\n", err, "unable to read log directory: %v\n", err,

View File

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -121,7 +120,7 @@ func (h *HarnessMiner) saveLogs() {
// After shutting down the miner, we'll make a copy of the log files // After shutting down the miner, we'll make a copy of the log files
// before deleting the temporary log dir. // before deleting the temporary log dir.
path := fmt.Sprintf("%s/%s", h.logPath, harnessNetParams.Name) path := fmt.Sprintf("%s/%s", h.logPath, harnessNetParams.Name)
files, err := ioutil.ReadDir(path) files, err := os.ReadDir(path)
require.NoError(h, err, "unable to read log directory") require.NoError(h, err, "unable to read log directory")
for _, file := range files { for _, file := range files {

View File

@ -1032,7 +1032,7 @@ func addLogFile(hn *HarnessNode) error {
// copyAll copies all files and directories from srcDir to dstDir recursively. // copyAll copies all files and directories from srcDir to dstDir recursively.
// Note that this function does not support links. // Note that this function does not support links.
func copyAll(dstDir, srcDir string) error { func copyAll(dstDir, srcDir string) error {
entries, err := ioutil.ReadDir(srcDir) entries, err := os.ReadDir(srcDir)
if err != nil { if err != nil {
return err return err
} }