From 127c6767866eb1bfe273aed41e52b7843e9be2fe Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 14 Aug 2023 14:17:45 +0300 Subject: [PATCH] [#607] *: Use keys.PublicKeys.Copy() where possible Semantic patch: ``` @@ var dst identifier var src identifier var keys identifier @@ import keys "github.com/nspcc-dev/neo-go/pkg/crypto/keys" -dst := make(keys.PublicKeys, len(src)) -copy(dst, src) +dst := src.Copy() ``` Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-adm/internal/modules/morph/generate.go | 3 +-- pkg/innerring/processors/governance/list_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/generate.go b/cmd/frostfs-adm/internal/modules/morph/generate.go index ccdc4519..55321582 100644 --- a/cmd/frostfs-adm/internal/modules/morph/generate.go +++ b/cmd/frostfs-adm/internal/modules/morph/generate.go @@ -104,8 +104,7 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er bftCount := smartcontract.GetDefaultHonestNodeCount(size) for i := range wallets { i := i - ps := make(keys.PublicKeys, len(pubs)) - copy(ps, pubs) + ps := pubs.Copy() errG.Go(func() error { if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil { return fmt.Errorf("can't create committee account: %w", err) diff --git a/pkg/innerring/processors/governance/list_test.go b/pkg/innerring/processors/governance/list_test.go index e0121ab6..d099ec83 100644 --- a/pkg/innerring/processors/governance/list_test.go +++ b/pkg/innerring/processors/governance/list_test.go @@ -60,8 +60,7 @@ func TestNewAlphabetList(t *testing.T) { orig := keys.PublicKeys{k[1], k[2], k[3], k[4]} main := keys.PublicKeys{k[1], k[2], k[5], k[4]} - exp := make(keys.PublicKeys, len(main)) - copy(exp, main) + exp := main.Copy() sort.Sort(exp) got, err := newAlphabetList(orig, main)