From 2ca5dfc2f60a5174c8077d4bbc3f5d7963b0f158 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 10 Apr 2024 14:15:56 +0300 Subject: [PATCH] Reapply "[#972] Adopt slices.BinarySearch()" This reverts commit 4bfc6d29b910bc8e85852180ca0caabbf2eff2f4. Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/container/container.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/container/container.go b/cmd/frostfs-adm/internal/modules/morph/container/container.go index 690db2f4..eda388d3 100644 --- a/cmd/frostfs-adm/internal/modules/morph/container/container.go +++ b/cmd/frostfs-adm/internal/modules/morph/container/container.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "os" + "slices" "sort" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" @@ -446,7 +447,7 @@ func getCIDFilterFunc(cmd *cobra.Command) (func([]byte) bool, error) { var id cid.ID id.SetSHA256(v) idStr := id.EncodeToString() - n := sort.Search(len(rawIDs), func(i int) bool { return rawIDs[i] >= idStr }) - return n < len(rawIDs) && rawIDs[n] == idStr + _, found := slices.BinarySearch(rawIDs, idStr) + return found }, nil }