Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil (#1990)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
  • Loading branch information
testwill committed Oct 17, 2023
1 parent 820e21a commit 7433edf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions command/genesis/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/hex"
"errors"
"fmt"
"io/ioutil"
"math/big"
"os"
"path/filepath"
Expand Down Expand Up @@ -219,7 +218,7 @@ func GetValidatorKeyFiles(rootDir, filePrefix string) ([]string, error) {
rootDir = "."
}

files, err := ioutil.ReadDir(rootDir)
files, err := os.ReadDir(rootDir)
if err != nil {
return nil, err
}
Expand Down
5 changes: 2 additions & 3 deletions e2e-polybft/framework/test-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"math/big"
"os"
"os/exec"
Expand Down Expand Up @@ -1085,11 +1084,11 @@ func CopyDir(source, destination string) error {
return nil
}

data, err := ioutil.ReadFile(filepath.Join(source, relPath))
data, err := os.ReadFile(filepath.Join(source, relPath))
if err != nil {
return err
}

return ioutil.WriteFile(filepath.Join(destination, relPath), data, 0600)
return os.WriteFile(filepath.Join(destination, relPath), data, 0600)
})
}
4 changes: 2 additions & 2 deletions e2e-polybft/framework/test-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package framework
import (
"errors"
"fmt"
"io/ioutil"
"math/big"
"os"
"strconv"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -120,7 +120,7 @@ func NewTestServer(t *testing.T, clusterConfig *TestClusterConfig,
}

if config.DataDir == "" {
dataDir, err := ioutil.TempDir("/tmp", "edge-e2e-")
dataDir, err := os.MkdirTemp("/tmp", "edge-e2e-")
require.NoError(t, err)

config.DataDir = dataDir
Expand Down
4 changes: 2 additions & 2 deletions e2e/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package e2e
import (
"context"
"fmt"
"io/ioutil"
"math/big"
"os"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -229,7 +229,7 @@ func TestGenesis_Predeployment(t *testing.T) {
clt := srv.JSONRPC()

// Extract the contract ABI from the metadata test file
content, err := ioutil.ReadFile(artifactPath)
content, err := os.ReadFile(artifactPath)
if err != nil {
t.Fatalf("unable to open JSON file, %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions tracker/event_tracker_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tracker

import (
"encoding/hex"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -19,7 +18,7 @@ func createSetupDB(subscriber eventSubscription, numBlockConfirmations uint64) s
return func(t *testing.T) (store.Store, func()) {
t.Helper()

dir, err := ioutil.TempDir("/tmp", "boltdb-test")
dir, err := os.MkdirTemp("/tmp", "boltdb-test")
require.NoError(t, err)

path := filepath.Join(dir, "test.db")
Expand Down

0 comments on commit 7433edf

Please sign in to comment.