forked from cerc-io/plugeth
all: replace uses of ioutil with io and os (#24869)
This commit is contained in:
+1
-2
@@ -19,7 +19,6 @@ package node
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -470,7 +469,7 @@ func getKeyStoreDir(conf *Config) (string, bool, error) {
|
||||
isEphemeral := false
|
||||
if keydir == "" {
|
||||
// There is no datadir.
|
||||
keydir, err = ioutil.TempDir("", "go-ethereum-keystore")
|
||||
keydir, err = os.MkdirTemp("", "go-ethereum-keystore")
|
||||
isEphemeral = true
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -18,7 +18,6 @@ package node
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -54,7 +53,7 @@ func TestDatadirCreation(t *testing.T) {
|
||||
t.Fatalf("freshly created datadir not accessible: %v", err)
|
||||
}
|
||||
// Verify that an impossible datadir fails creation
|
||||
file, err := ioutil.TempFile("", "")
|
||||
file, err := os.CreateTemp("", "")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create temporary file: %v", err)
|
||||
}
|
||||
@@ -132,7 +131,7 @@ func TestNodeKeyPersistency(t *testing.T) {
|
||||
if _, err = crypto.LoadECDSA(keyfile); err != nil {
|
||||
t.Fatalf("failed to load freshly persisted node key: %v", err)
|
||||
}
|
||||
blob1, err := ioutil.ReadFile(keyfile)
|
||||
blob1, err := os.ReadFile(keyfile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read freshly persisted node key: %v", err)
|
||||
}
|
||||
@@ -140,7 +139,7 @@ func TestNodeKeyPersistency(t *testing.T) {
|
||||
// Configure a new node and ensure the previously persisted key is loaded
|
||||
config = &Config{Name: "unit-test", DataDir: dir}
|
||||
config.NodeKey()
|
||||
blob2, err := ioutil.ReadFile(filepath.Join(keyfile))
|
||||
blob2, err := os.ReadFile(filepath.Join(keyfile))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read previously persisted node key: %v", err)
|
||||
}
|
||||
|
||||
+1
-2
@@ -21,7 +21,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"sort"
|
||||
@@ -444,7 +443,7 @@ func (h *virtualHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var gzPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
w := gzip.NewWriter(ioutil.Discard)
|
||||
w := gzip.NewWriter(io.Discard)
|
||||
return w
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user