Skip to content

Commit 10eaea8

Browse files
committed
refactor: replace golang.org/x/exp with stdlib
Signed-off-by: wangjingcun <wangjingcun@aliyun.com>
1 parent 8a40954 commit 10eaea8

19 files changed

+19
-21
lines changed

accounts/keystore/account_cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"fmt"
3333
"os"
3434
"path/filepath"
35+
"slices"
3536
"sort"
3637
"strings"
3738
"sync"
@@ -41,7 +42,6 @@ import (
4142
mapset "github.com/deckarep/golang-set/v2"
4243
"github.com/ethereum/go-ethereum/common"
4344
"github.com/ethereum/go-ethereum/log"
44-
"golang.org/x/exp/slices"
4545
)
4646

4747
// Minimum amount of time between cache reloads. This limit applies if the platform does

accounts/keystore/account_cache_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ import (
3333
"os"
3434
"path/filepath"
3535
"reflect"
36+
"slices"
3637
"testing"
3738
"time"
3839

3940
"github.com/ava-labs/subnet-evm/accounts"
4041
"github.com/cespare/cp"
4142
"github.com/davecgh/go-spew/spew"
4243
"github.com/ethereum/go-ethereum/common"
43-
"golang.org/x/exp/slices"
4444
)
4545

4646
var (

accounts/keystore/keystore_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"math/rand"
3131
"os"
3232
"runtime"
33+
"slices"
3334
"strings"
3435
"sync"
3536
"sync/atomic"
@@ -40,7 +41,6 @@ import (
4041
"github.com/ethereum/go-ethereum/common"
4142
"github.com/ethereum/go-ethereum/crypto"
4243
"github.com/ethereum/go-ethereum/event"
43-
"golang.org/x/exp/slices"
4444
)
4545

4646
var testSigData = make([]byte, 32)

core/mkalloc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ import (
4040
"fmt"
4141
"math/big"
4242
"os"
43+
"slices"
4344
"strconv"
4445

4546
"github.com/ava-labs/subnet-evm/core"
4647
"github.com/ethereum/go-ethereum/common"
4748
"github.com/ethereum/go-ethereum/rlp"
48-
"golang.org/x/exp/slices"
4949
)
5050

5151
type allocItem struct {

core/state/snapshot/difflayer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"fmt"
3232
"math"
3333
"math/rand"
34+
"slices"
3435
"sync"
3536
"sync/atomic"
3637
"time"
@@ -39,7 +40,6 @@ import (
3940
"github.com/ethereum/go-ethereum/common"
4041
"github.com/ethereum/go-ethereum/rlp"
4142
bloomfilter "github.com/holiman/bloomfilter/v2"
42-
"golang.org/x/exp/slices"
4343
)
4444

4545
var (

core/state/snapshot/iterator_fast.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ package snapshot
2929
import (
3030
"bytes"
3131
"fmt"
32+
"slices"
3233
"sort"
3334

3435
"github.com/ethereum/go-ethereum/common"
35-
"golang.org/x/exp/slices"
3636
)
3737

3838
// weightedIterator is a iterator with an assigned weight. It is used to prioritise

core/txpool/legacypool/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"container/heap"
3131
"math"
3232
"math/big"
33+
"slices"
3334
"sort"
3435
"sync"
3536
"sync/atomic"
@@ -38,7 +39,6 @@ import (
3839
"github.com/ava-labs/subnet-evm/core/types"
3940
"github.com/ethereum/go-ethereum/common"
4041
"github.com/holiman/uint256"
41-
"golang.org/x/exp/slices"
4242
)
4343

4444
// nonceHeap is a heap.Interface implementation over 64bit unsigned integers for

eth/api_debug_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import (
4444
"github.com/ethereum/go-ethereum/common"
4545
"github.com/ethereum/go-ethereum/crypto"
4646

47-
"golang.org/x/exp/slices"
47+
"slices"
4848
)
4949

5050
var dumper = spew.ConfigState{Indent: " "}

eth/gasprice/gasprice.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"context"
3131
"fmt"
3232
"math/big"
33+
"slices"
3334
"sync"
3435

3536
"github.com/ava-labs/avalanchego/utils/timer/mockable"
@@ -45,7 +46,6 @@ import (
4546
"github.com/ethereum/go-ethereum/common/math"
4647
"github.com/ethereum/go-ethereum/event"
4748
"github.com/ethereum/go-ethereum/log"
48-
"golang.org/x/exp/slices"
4949
)
5050

5151
const (

eth/tracers/api_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"fmt"
3535
"math/big"
3636
"reflect"
37+
"slices"
3738
"sync/atomic"
3839
"testing"
3940

@@ -52,7 +53,6 @@ import (
5253
"github.com/ethereum/go-ethereum/common/hexutil"
5354
"github.com/ethereum/go-ethereum/crypto"
5455
"github.com/ethereum/go-ethereum/ethdb"
55-
"golang.org/x/exp/slices"
5656
)
5757

5858
var (

internal/ethapi/api_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import (
6464
"github.com/ethereum/go-ethereum/event"
6565
"github.com/holiman/uint256"
6666
"github.com/stretchr/testify/require"
67-
"golang.org/x/exp/slices"
67+
"slices"
6868
)
6969

7070
func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainConfig) {

metrics/sample.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package metrics
33
import (
44
"math"
55
"math/rand"
6+
"slices"
67
"sync"
78
"time"
8-
9-
"golang.org/x/exp/slices"
109
)
1110

1211
const rescaleThreshold = time.Hour

metrics/writer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
"time"
88

9-
"golang.org/x/exp/slices"
9+
"slices"
1010
)
1111

1212
// Write sorts writes each metric in the given registry periodically to the

metrics/writer_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package metrics
22

33
import (
4+
"slices"
45
"testing"
5-
6-
"golang.org/x/exp/slices"
76
)
87

98
func TestMetricsSorting(t *testing.T) {

trie/proof_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ import (
3232
"encoding/binary"
3333
"fmt"
3434
mrand "math/rand"
35+
"slices"
3536
"testing"
3637

3738
"github.com/ava-labs/subnet-evm/core/rawdb"
3839
"github.com/ethereum/go-ethereum/common"
3940
"github.com/ethereum/go-ethereum/crypto"
4041
"github.com/ethereum/go-ethereum/ethdb/memorydb"
41-
"golang.org/x/exp/slices"
4242
)
4343

4444
// Prng is a pseudo random number generator seeded by strong randomness.

trie/stacktrie_fuzzer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"bytes"
2121
"encoding/binary"
2222
"fmt"
23+
"slices"
2324
"testing"
2425

2526
"github.com/ava-labs/subnet-evm/core/rawdb"
@@ -28,7 +29,6 @@ import (
2829
"github.com/ethereum/go-ethereum/common"
2930
"github.com/ethereum/go-ethereum/crypto"
3031
"golang.org/x/crypto/sha3"
31-
"golang.org/x/exp/slices"
3232
)
3333

3434
func FuzzStackTrie(f *testing.F) {

trie/stacktrie_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ import (
3030
"bytes"
3131
"math/big"
3232
"math/rand"
33+
"slices"
3334
"testing"
3435

3536
"github.com/ava-labs/subnet-evm/core/rawdb"
3637
"github.com/ava-labs/subnet-evm/trie/testutil"
3738
"github.com/ethereum/go-ethereum/common"
3839
"github.com/ethereum/go-ethereum/crypto"
3940
"github.com/stretchr/testify/assert"
40-
"golang.org/x/exp/slices"
4141
)
4242

4343
func TestStackTrieInsertAndHash(t *testing.T) {

triedb/pathdb/history.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ import (
3131
"encoding/binary"
3232
"errors"
3333
"fmt"
34+
"slices"
3435

3536
"github.com/ava-labs/subnet-evm/trie/triestate"
3637
"github.com/ethereum/go-ethereum/common"
37-
"golang.org/x/exp/slices"
3838
)
3939

4040
// State history records the state changes involved in executing a block. The

triedb/pathdb/testutils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ package pathdb
2929
import (
3030
"bytes"
3131
"fmt"
32+
"slices"
3233

3334
"github.com/ava-labs/subnet-evm/core/types"
3435
"github.com/ava-labs/subnet-evm/trie/trienode"
3536
"github.com/ava-labs/subnet-evm/trie/triestate"
3637
"github.com/ethereum/go-ethereum/common"
3738
"github.com/ethereum/go-ethereum/crypto"
38-
"golang.org/x/exp/slices"
3939
)
4040

4141
// testHasher is a test utility for computing root hash of a batch of state

0 commit comments

Comments
 (0)