[#236] *: Replace slice.Copy() with bytes.Clone()

The former is deprecated.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-07-12 15:42:55 +03:00
parent e977b8a94c
commit fc7c524fcb
3 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,7 @@
package session_test
import (
"bytes"
"crypto/rand"
"fmt"
"math"
@ -17,7 +18,6 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test"
"github.com/google/uuid"
"github.com/nspcc-dev/neo-go/pkg/util/slice"
"github.com/stretchr/testify/require"
)
@ -179,7 +179,7 @@ func TestContainerProtocolV2(t *testing.T) {
breakSign: func(m *v2session.Token) {
body := m.GetBody()
key := body.GetSessionKey()
cp := slice.Copy(key)
cp := bytes.Clone(key)
cp[len(cp)-1]++
body.SetSessionKey(cp)
},

View file

@ -1,6 +1,7 @@
package session_test
import (
"bytes"
"crypto/ecdsa"
"fmt"
"math"
@ -19,7 +20,6 @@ import (
usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test"
"github.com/google/uuid"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/util/slice"
"github.com/stretchr/testify/require"
)
@ -200,7 +200,7 @@ func TestObjectProtocolV2(t *testing.T) {
breakSign: func(m *v2session.Token) {
body := m.GetBody()
key := body.GetSessionKey()
cp := slice.Copy(key)
cp := bytes.Clone(key)
cp[len(cp)-1]++
body.SetSessionKey(cp)
},

View file

@ -1,6 +1,7 @@
package user_test
import (
"bytes"
"crypto/rand"
"testing"
@ -10,7 +11,6 @@ import (
"github.com/mr-tron/base58"
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/util/slice"
"github.com/stretchr/testify/require"
)
@ -84,7 +84,7 @@ func TestV2_ID(t *testing.T) {
})
t.Run("invalid prefix", func(t *testing.T) {
val := slice.Copy(val)
val := bytes.Clone(val)
val[0]++
m.SetValue(val)
@ -94,7 +94,7 @@ func TestV2_ID(t *testing.T) {
})
t.Run("invalid checksum", func(t *testing.T) {
val := slice.Copy(val)
val := bytes.Clone(val)
val[21]++
m.SetValue(val)