Skip to content

Commit 92e0e00

Browse files
authored
refactor: replace experimental maps and slices with stdlib (#6179)
Signed-off-by: Eng Zer Jun <[email protected]>
1 parent 0bc3d7e commit 92e0e00

File tree

37 files changed

+69
-74
lines changed

37 files changed

+69
-74
lines changed

agreement/agreementtest/simulate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package agreementtest
1919
import (
2020
"context"
2121
"fmt"
22+
"maps"
2223
"math/rand"
2324
"os"
2425
"strconv"
@@ -27,7 +28,6 @@ import (
2728

2829
"github.com/algorand/go-deadlock"
2930
"github.com/stretchr/testify/require"
30-
"golang.org/x/exp/maps"
3131

3232
"github.com/algorand/go-algorand/agreement"
3333
"github.com/algorand/go-algorand/config"

agreement/autopsy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"fmt"
2121
"io"
2222
"os"
23+
"slices"
2324

2425
"github.com/algorand/go-algorand/data/basics"
2526
"github.com/algorand/go-algorand/logging"
2627
"github.com/algorand/go-algorand/protocol"
27-
"golang.org/x/exp/slices"
2828
)
2929

3030
// An Autopsy is a trace of the ordered input events and output

agreement/common_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package agreement
1919
import (
2020
"context"
2121
"fmt"
22+
"maps"
2223
"math/rand"
2324
"testing"
2425

2526
"github.com/algorand/go-deadlock"
2627
"github.com/stretchr/testify/require"
27-
"golang.org/x/exp/maps"
2828

2929
"github.com/algorand/go-algorand/config"
3030
"github.com/algorand/go-algorand/crypto"

cmd/algokey/keyreg.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ import (
2020
"encoding/base64"
2121
"errors"
2222
"fmt"
23+
"maps"
2324
"os"
25+
"slices"
2426
"strings"
2527

2628
"github.com/spf13/cobra"
27-
"golang.org/x/exp/maps"
2829

2930
"github.com/algorand/go-algorand/crypto"
3031
"github.com/algorand/go-algorand/data/account"
@@ -95,7 +96,7 @@ func init() {
9596
"betanet": mustConvertB64ToDigest("mFgazF+2uRS1tMiL9dsj01hJGySEmPN28B/TjjvpVW0="),
9697
"devnet": mustConvertB64ToDigest("sC3P7e2SdbqKJK0tbiCdK9tdSpbe6XeCGKdoNzmlj0E="),
9798
}
98-
validNetworkList = maps.Keys(validNetworks)
99+
validNetworkList = slices.Collect(maps.Keys(validNetworks))
99100
}
100101

101102
func mustConvertB64ToDigest(b64 string) (digest crypto.Digest) {

cmd/goal/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import (
2424
"net/http"
2525
"os"
2626
"path/filepath"
27+
"slices"
2728
"sort"
2829
"strings"
2930
"time"
3031

3132
"github.com/spf13/cobra"
32-
"golang.org/x/exp/slices"
3333

3434
"github.com/algorand/go-algorand/cmd/util/datadir"
3535
"github.com/algorand/go-algorand/config"

cmd/tealdbg/local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"io"
2222
"log"
23+
"slices"
2324
"time"
2425

2526
"github.com/algorand/go-algorand/config"
@@ -28,7 +29,6 @@ import (
2829
"github.com/algorand/go-algorand/data/transactions/logic"
2930
"github.com/algorand/go-algorand/ledger/apply"
3031
"github.com/algorand/go-algorand/protocol"
31-
"golang.org/x/exp/slices"
3232
)
3333

3434
func protoFromString(protoString string) (name string, proto config.ConsensusParams, err error) {

crypto/merklearray/merkle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import (
2121
"errors"
2222
"fmt"
2323
"hash"
24+
"slices"
2425
"sort"
2526

2627
"github.com/algorand/go-algorand/crypto"
27-
"golang.org/x/exp/slices"
2828
)
2929

3030
const (

crypto/merkletrie/cache.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ import (
2121
"encoding/binary"
2222
"errors"
2323
"fmt"
24-
25-
"golang.org/x/exp/maps"
26-
"golang.org/x/exp/slices"
24+
"maps"
25+
"slices"
2726
)
2827

2928
// storedNodeIdentifier is the "equivalent" of a node-ptr, but oriented around persisting the
@@ -448,8 +447,7 @@ func (mtc *merkleTrieCache) reallocatePendingPages(stats *CommitStats) (pagesToC
448447
}
449448

450449
// create a sorted list of created pages
451-
sortedCreatedPages := maps.Keys(createdPages)
452-
slices.Sort(sortedCreatedPages)
450+
sortedCreatedPages := slices.Sorted(maps.Keys(createdPages))
453451

454452
mtc.reallocatedPages = make(map[uint64]map[storedNodeIdentifier]*node)
455453

crypto/merkletrie/committer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package merkletrie
1818

19-
import "golang.org/x/exp/slices"
19+
import "slices"
2020

2121
// Committer is the interface supporting serializing tries into persistent storage.
2222
type Committer interface {

crypto/merkletrie/committer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ package merkletrie
1818

1919
import (
2020
"encoding/binary"
21+
"slices"
2122
"testing"
2223

2324
"github.com/stretchr/testify/require"
24-
"golang.org/x/exp/slices"
2525

2626
"github.com/algorand/go-algorand/crypto"
2727
"github.com/algorand/go-algorand/test/partitiontest"

0 commit comments

Comments
 (0)