From 0ed98e07181c03beaed8ce5e32b3692b1b75062e Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 25 Sep 2023 18:47:48 +0800 Subject: [PATCH] all: replace golang.org/x/exp/slices with slices Signed-off-by: jsvisa --- accounts/keystore/account_cache.go | 2 +- accounts/keystore/account_cache_test.go | 2 +- accounts/keystore/keystore_test.go | 2 +- build/update-license.go | 2 +- cmd/devp2p/dns_route53.go | 2 +- cmd/devp2p/nodeset.go | 2 +- consensus/clique/snapshot.go | 2 +- consensus/clique/snapshot_test.go | 2 +- core/blockchain.go | 2 +- core/forkid/forkid.go | 2 +- core/mkalloc.go | 2 +- core/rawdb/accessors_chain.go | 2 +- core/state/snapshot/difflayer.go | 2 +- core/state/snapshot/iterator_fast.go | 2 +- eth/api_debug_test.go | 2 +- eth/gasprice/feehistory.go | 2 +- eth/gasprice/gasprice.go | 2 +- eth/protocols/snap/sync_test.go | 2 +- eth/tracers/api_test.go | 2 +- ethdb/dbtest/testsuite.go | 2 +- internal/ethapi/api_test.go | 2 +- les/servingqueue.go | 2 +- les/utils/limiter.go | 2 +- metrics/sample.go | 2 +- metrics/writer.go | 2 +- metrics/writer_test.go | 2 +- p2p/discover/ntp.go | 2 +- p2p/discover/table_util_test.go | 2 +- p2p/discover/v4_lookup_test.go | 2 +- p2p/discover/v5_udp_test.go | 2 +- p2p/dnsdisc/tree.go | 2 +- p2p/peer.go | 2 +- p2p/server.go | 2 +- tests/fuzzers/rangeproof/rangeproof-fuzzer.go | 2 +- tests/fuzzers/stacktrie/trie_fuzzer.go | 2 +- trie/proof_test.go | 2 +- trie/triedb/pathdb/history.go | 2 +- trie/triedb/pathdb/testutils.go | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index 4ed1439514..1dcc40071e 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -31,7 +31,7 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" - "golang.org/x/exp/slices" + "slices" ) // Minimum amount of time between cache reloads. This limit applies if the platform does diff --git a/accounts/keystore/account_cache_test.go b/accounts/keystore/account_cache_test.go index 3847e9daf6..18376011b2 100644 --- a/accounts/keystore/account_cache_test.go +++ b/accounts/keystore/account_cache_test.go @@ -30,7 +30,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/accounts/keystore/keystore_test.go b/accounts/keystore/keystore_test.go index deb7cae9f9..eb8aa834f1 100644 --- a/accounts/keystore/keystore_test.go +++ b/accounts/keystore/keystore_test.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/event" - "golang.org/x/exp/slices" + "slices" ) var testSigData = make([]byte, 32) diff --git a/build/update-license.go b/build/update-license.go index 52a54bf66a..e2f6e93f20 100644 --- a/build/update-license.go +++ b/build/update-license.go @@ -52,7 +52,7 @@ import ( "text/template" "time" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/cmd/devp2p/dns_route53.go b/cmd/devp2p/dns_route53.go index 21a32f9414..dd29c3cf40 100644 --- a/cmd/devp2p/dns_route53.go +++ b/cmd/devp2p/dns_route53.go @@ -32,7 +32,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/dnsdisc" "github.com/urfave/cli/v2" - "golang.org/x/exp/slices" + "slices" ) const ( diff --git a/cmd/devp2p/nodeset.go b/cmd/devp2p/nodeset.go index 7360dc5bcf..7cd7e71899 100644 --- a/cmd/devp2p/nodeset.go +++ b/cmd/devp2p/nodeset.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/p2p/enode" - "golang.org/x/exp/slices" + "slices" ) const jsonIndent = " " diff --git a/consensus/clique/snapshot.go b/consensus/clique/snapshot.go index a97115121b..21f59bb9d5 100644 --- a/consensus/clique/snapshot.go +++ b/consensus/clique/snapshot.go @@ -28,7 +28,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - "golang.org/x/exp/slices" + "slices" ) // Vote represents a single vote that an authorized signer made to modify the diff --git a/consensus/clique/snapshot_test.go b/consensus/clique/snapshot_test.go index 26cebe008a..20cc77eeac 100644 --- a/consensus/clique/snapshot_test.go +++ b/consensus/clique/snapshot_test.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" - "golang.org/x/exp/slices" + "slices" ) // testerAccountPool is a pool to maintain currently active tester accounts, diff --git a/core/blockchain.go b/core/blockchain.go index e371e8d926..63fdc638bb 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -50,7 +50,7 @@ import ( "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie/triedb/hashdb" "github.com/ethereum/go-ethereum/trie/triedb/pathdb" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/core/forkid/forkid.go b/core/forkid/forkid.go index 76825d3bef..3eb4693377 100644 --- a/core/forkid/forkid.go +++ b/core/forkid/forkid.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/core/mkalloc.go b/core/mkalloc.go index 12c40c14fb..ca2a1a3d04 100644 --- a/core/mkalloc.go +++ b/core/mkalloc.go @@ -35,7 +35,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/rlp" - "golang.org/x/exp/slices" + "slices" ) type allocItem struct { diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 97401d283c..3fbe2c9203 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -31,7 +31,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" - "golang.org/x/exp/slices" + "slices" ) // ReadCanonicalHash retrieves the hash assigned to a canonical block number. diff --git a/core/state/snapshot/difflayer.go b/core/state/snapshot/difflayer.go index b6aca599c5..72b07228e7 100644 --- a/core/state/snapshot/difflayer.go +++ b/core/state/snapshot/difflayer.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" bloomfilter "github.com/holiman/bloomfilter/v2" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/core/state/snapshot/iterator_fast.go b/core/state/snapshot/iterator_fast.go index 0502d9cf85..2380d4a028 100644 --- a/core/state/snapshot/iterator_fast.go +++ b/core/state/snapshot/iterator_fast.go @@ -22,7 +22,7 @@ import ( "sort" "github.com/ethereum/go-ethereum/common" - "golang.org/x/exp/slices" + "slices" ) // weightedIterator is a iterator with an assigned weight. It is used to prioritise diff --git a/eth/api_debug_test.go b/eth/api_debug_test.go index 3d3444a871..65392bf0e4 100644 --- a/eth/api_debug_test.go +++ b/eth/api_debug_test.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/trie" - "golang.org/x/exp/slices" + "slices" ) var dumper = spew.ConfigState{Indent: " "} diff --git a/eth/gasprice/feehistory.go b/eth/gasprice/feehistory.go index 226991b24b..d4ab8969be 100644 --- a/eth/gasprice/feehistory.go +++ b/eth/gasprice/feehistory.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rpc" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index b719649811..95ebec0bb2 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - "golang.org/x/exp/slices" + "slices" ) const sampleNumber = 3 // Number of transactions sampled in a block diff --git a/eth/protocols/snap/sync_test.go b/eth/protocols/snap/sync_test.go index 1514ad4e13..a3a33d2ad7 100644 --- a/eth/protocols/snap/sync_test.go +++ b/eth/protocols/snap/sync_test.go @@ -38,7 +38,7 @@ import ( "github.com/ethereum/go-ethereum/trie/triedb/pathdb" "github.com/ethereum/go-ethereum/trie/trienode" "golang.org/x/crypto/sha3" - "golang.org/x/exp/slices" + "slices" ) func TestHashing(t *testing.T) { diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index 0f78af9a01..c7694c1d8a 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -43,7 +43,7 @@ import ( "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/ethdb/dbtest/testsuite.go b/ethdb/dbtest/testsuite.go index 0d3d5f5aa6..b3cac949e1 100644 --- a/ethdb/dbtest/testsuite.go +++ b/ethdb/dbtest/testsuite.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/ethdb" - "golang.org/x/exp/slices" + "slices" ) // TestDatabaseSuite runs a suite of tests against a KeyValueStore database diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index fc135c3779..743313fea6 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -50,7 +50,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/holiman/uint256" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" + "slices" ) func testTransactionMarshal(t *testing.T, tests []txData, config *params.ChainConfig) { diff --git a/les/servingqueue.go b/les/servingqueue.go index b258fc3caf..6847a3c745 100644 --- a/les/servingqueue.go +++ b/les/servingqueue.go @@ -22,7 +22,7 @@ import ( "github.com/ethereum/go-ethereum/common/mclock" "github.com/ethereum/go-ethereum/common/prque" - "golang.org/x/exp/slices" + "slices" ) // servingQueue allows running tasks in a limited number of threads and puts the diff --git a/les/utils/limiter.go b/les/utils/limiter.go index 70b7ff64f7..0986196659 100644 --- a/les/utils/limiter.go +++ b/les/utils/limiter.go @@ -20,7 +20,7 @@ import ( "sync" "github.com/ethereum/go-ethereum/p2p/enode" - "golang.org/x/exp/slices" + "slices" ) const maxSelectionWeight = 1000000000 // maximum selection weight of each individual node/address group diff --git a/metrics/sample.go b/metrics/sample.go index 5398dd42d5..086ebdf537 100644 --- a/metrics/sample.go +++ b/metrics/sample.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "golang.org/x/exp/slices" + "slices" ) const rescaleThreshold = time.Hour diff --git a/metrics/writer.go b/metrics/writer.go index 098da45c27..2a4370e27a 100644 --- a/metrics/writer.go +++ b/metrics/writer.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "golang.org/x/exp/slices" + "slices" ) // Write sorts writes each metric in the given registry periodically to the diff --git a/metrics/writer_test.go b/metrics/writer_test.go index 8376bf8975..b2b7ad9e84 100644 --- a/metrics/writer_test.go +++ b/metrics/writer_test.go @@ -3,7 +3,7 @@ package metrics import ( "testing" - "golang.org/x/exp/slices" + "slices" ) func TestMetricsSorting(t *testing.T) { diff --git a/p2p/discover/ntp.go b/p2p/discover/ntp.go index 3f9157808f..c87a49b9ed 100644 --- a/p2p/discover/ntp.go +++ b/p2p/discover/ntp.go @@ -25,7 +25,7 @@ import ( "time" "github.com/ethereum/go-ethereum/log" - "golang.org/x/exp/slices" + "slices" ) const ( diff --git a/p2p/discover/table_util_test.go b/p2p/discover/table_util_test.go index 8f3813bdcf..b104575efe 100644 --- a/p2p/discover/table_util_test.go +++ b/p2p/discover/table_util_test.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" - "golang.org/x/exp/slices" + "slices" ) var nullNode *enode.Node diff --git a/p2p/discover/v4_lookup_test.go b/p2p/discover/v4_lookup_test.go index 1f9ad69d0a..ee623e628c 100644 --- a/p2p/discover/v4_lookup_test.go +++ b/p2p/discover/v4_lookup_test.go @@ -26,7 +26,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/discover/v4wire" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" - "golang.org/x/exp/slices" + "slices" ) func TestUDPv4_Lookup(t *testing.T) { diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index 880b71a991..a0e2eeda91 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -34,7 +34,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/enr" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" + "slices" ) // Real sockets, real crypto: this test checks end-to-end connectivity for UDPv5. diff --git a/p2p/dnsdisc/tree.go b/p2p/dnsdisc/tree.go index 06b7681f18..ca0abbc518 100644 --- a/p2p/dnsdisc/tree.go +++ b/p2p/dnsdisc/tree.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/enr" "github.com/ethereum/go-ethereum/rlp" "golang.org/x/crypto/sha3" - "golang.org/x/exp/slices" + "slices" ) // Tree is a merkle tree of node records. diff --git a/p2p/peer.go b/p2p/peer.go index 65a7903f58..8705d13c77 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -31,7 +31,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" "github.com/ethereum/go-ethereum/rlp" - "golang.org/x/exp/slices" + "slices" ) var ( diff --git a/p2p/server.go b/p2p/server.go index 8f42765a8c..bbebaedff2 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -38,7 +38,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/enr" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/p2p/netutil" - "golang.org/x/exp/slices" + "slices" ) const ( diff --git a/tests/fuzzers/rangeproof/rangeproof-fuzzer.go b/tests/fuzzers/rangeproof/rangeproof-fuzzer.go index ba490b761f..7094a25caf 100644 --- a/tests/fuzzers/rangeproof/rangeproof-fuzzer.go +++ b/tests/fuzzers/rangeproof/rangeproof-fuzzer.go @@ -26,7 +26,7 @@ import ( "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/ethdb/memorydb" "github.com/ethereum/go-ethereum/trie" - "golang.org/x/exp/slices" + "slices" ) type kv struct { diff --git a/tests/fuzzers/stacktrie/trie_fuzzer.go b/tests/fuzzers/stacktrie/trie_fuzzer.go index 3d65524095..cda040914e 100644 --- a/tests/fuzzers/stacktrie/trie_fuzzer.go +++ b/tests/fuzzers/stacktrie/trie_fuzzer.go @@ -32,7 +32,7 @@ import ( "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie/trienode" "golang.org/x/crypto/sha3" - "golang.org/x/exp/slices" + "slices" ) type fuzzer struct { diff --git a/trie/proof_test.go b/trie/proof_test.go index fc2de62649..68ca0f24a0 100644 --- a/trie/proof_test.go +++ b/trie/proof_test.go @@ -28,7 +28,7 @@ import ( "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb/memorydb" - "golang.org/x/exp/slices" + "slices" ) // Prng is a pseudo random number generator seeded by strong randomness. diff --git a/trie/triedb/pathdb/history.go b/trie/triedb/pathdb/history.go index ce82532507..b2d4ff5aba 100644 --- a/trie/triedb/pathdb/history.go +++ b/trie/triedb/pathdb/history.go @@ -28,7 +28,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/trie/triestate" - "golang.org/x/exp/slices" + "slices" ) // State history records the state changes involved in executing a block. The diff --git a/trie/triedb/pathdb/testutils.go b/trie/triedb/pathdb/testutils.go index d6fdacb421..2288edce8e 100644 --- a/trie/triedb/pathdb/testutils.go +++ b/trie/triedb/pathdb/testutils.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/trie/trienode" "github.com/ethereum/go-ethereum/trie/triestate" - "golang.org/x/exp/slices" + "slices" ) // testHasher is a test utility for computing root hash of a batch of state