forked from cerc-io/plugeth
all: replace uses of ioutil with io and os (#24869)
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -334,7 +334,7 @@ func TestPrecompiledBLS12381MapG1Fail(t *testing.T) { testJsonFail("blsMapG
|
||||
func TestPrecompiledBLS12381MapG2Fail(t *testing.T) { testJsonFail("blsMapG2", "12", t) }
|
||||
|
||||
func loadJson(name string) ([]precompiledTest, error) {
|
||||
data, err := ioutil.ReadFile(fmt.Sprintf("testdata/precompiles/%v.json", name))
|
||||
data, err := os.ReadFile(fmt.Sprintf("testdata/precompiles/%v.json", name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -344,7 +344,7 @@ func loadJson(name string) ([]precompiledTest, error) {
|
||||
}
|
||||
|
||||
func loadJsonFail(name string) ([]precompiledFailureTest, error) {
|
||||
data, err := ioutil.ReadFile(fmt.Sprintf("testdata/precompiles/fail-%v.json", name))
|
||||
data, err := os.ReadFile(fmt.Sprintf("testdata/precompiles/fail-%v.json", name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@@ -260,7 +260,7 @@ func TestWriteExpectedValues(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = ioutil.WriteFile(fmt.Sprintf("testdata/testcases_%v.json", name), data, 0644)
|
||||
_ = os.WriteFile(fmt.Sprintf("testdata/testcases_%v.json", name), data, 0644)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -270,7 +270,7 @@ func TestWriteExpectedValues(t *testing.T) {
|
||||
// TestJsonTestcases runs through all the testcases defined as json-files
|
||||
func TestJsonTestcases(t *testing.T) {
|
||||
for name := range twoOpMethods {
|
||||
data, err := ioutil.ReadFile(fmt.Sprintf("testdata/testcases_%v.json", name))
|
||||
data, err := os.ReadFile(fmt.Sprintf("testdata/testcases_%v.json", name))
|
||||
if err != nil {
|
||||
t.Fatal("Failed to read file", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user