[#972] Adopt slices.BinarySearch()

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-02-14 10:14:32 +03:00 committed by Evgenii Stratonikov
parent 89784b2e0a
commit d2f13a29de

View file

@ -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
}