Documentation
¶
Overview ¶
Package searchmigrate defines an analyzer that detects sort.Search calls that could potentially be replaced with slices.BinarySearch or slices.BinarySearchFunc.
Analyzer searchmigrate ¶
searchmigrate: detect sort.Search that can potentially use slices.BinarySearch
This analyzer flags all calls to sort.Search(n, func...) as candidates for migration to the slices package. No auto-fix is provided because the transformation depends on the closure body and is not always straightforward.
Example:
sort.Search(len(s), func(i int) bool { return s[i] >= target })
May be replaceable with:
slices.BinarySearch(s, target)
Available since Go 1.21.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.