From fc7c524fcb3042efb38d2f1ef4e27ceec723a0ed Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Jul 2024 15:42:55 +0300 Subject: [PATCH] [#236] *: Replace slice.Copy() with bytes.Clone() The former is deprecated. Signed-off-by: Evgenii Stratonikov --- session/container_test.go | 4 ++-- session/object_test.go | 4 ++-- user/id_test.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/session/container_test.go b/session/container_test.go index d906482..73fd815 100644 --- a/session/container_test.go +++ b/session/container_test.go @@ -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) }, diff --git a/session/object_test.go b/session/object_test.go index 1df0f76..6990ff8 100644 --- a/session/object_test.go +++ b/session/object_test.go @@ -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) }, diff --git a/user/id_test.go b/user/id_test.go index 00b0884..9867472 100644 --- a/user/id_test.go +++ b/user/id_test.go @@ -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)