all: replace uses of ioutil with io and os (#24869)

This commit is contained in:
Håvard Anda Estensen
2022-05-16 11:59:35 +02:00
committed by GitHub
parent 330e53fbb9
commit 07508ac0e9
97 changed files with 203 additions and 257 deletions
+3 -2
View File
@@ -22,6 +22,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"testing"
@@ -362,7 +363,7 @@ func TestJsonFiles(t *testing.T) {
continue
}
expectedFailure := strings.HasPrefix(fInfo.Name(), "expfail")
data, err := ioutil.ReadFile(path.Join("testdata", fInfo.Name()))
data, err := os.ReadFile(path.Join("testdata", fInfo.Name()))
if err != nil {
t.Errorf("Failed to read file %v: %v", fInfo.Name(), err)
continue
@@ -394,7 +395,7 @@ func TestFuzzerFiles(t *testing.T) {
}
verbose := false
for i, fInfo := range testfiles {
data, err := ioutil.ReadFile(path.Join(corpusdir, fInfo.Name()))
data, err := os.ReadFile(path.Join(corpusdir, fInfo.Name()))
if err != nil {
t.Errorf("Failed to read file %v: %v", fInfo.Name(), err)
continue
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"math/big"
"os"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
@@ -175,7 +175,7 @@ func (s *UIServerAPI) Export(ctx context.Context, addr common.Address) (json.Raw
if wallet.URL().Scheme != keystore.KeyStoreScheme {
return nil, fmt.Errorf("account is not a keystore-account")
}
return ioutil.ReadFile(wallet.URL().Path)
return os.ReadFile(wallet.URL().Path)
}
// Import tries to import the given keyJSON in the local keystore. The keyJSON data is expected to be