mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
477a1cc40e
- Move the file `compare.go` and `slice.go` to `slice.go`. - Fix `ExistsInSlice`, it's buggy - It uses `sort.Search`, so it assumes that the input slice is sorted. - It passes `func(i int) bool { return slice[i] == target })` to `sort.Search`, that's incorrect, check the doc of `sort.Search`. - Conbine `IsInt64InSlice(int64, []int64)` and `ExistsInSlice(string, []string)` to `SliceContains[T]([]T, T)`. - Conbine `IsSliceInt64Eq([]int64, []int64)` and `IsEqualSlice([]string, []string)` to `SliceSortedEqual[T]([]T, T)`. - Add `SliceEqual[T]([]T, T)` as a distinction from `SliceSortedEqual[T]([]T, T)`. - Redesign `RemoveIDFromList([]int64, int64) ([]int64, bool)` to `SliceRemoveAll[T]([]T, T) []T`. - Add `SliceContainsFunc[T]([]T, func(T) bool)` and `SliceRemoveAllFunc[T]([]T, func(T) bool)` for general use. - Add comments to explain why not `golang.org/x/exp/slices`. - Add unit tests. |
||
---|---|---|
.. | ||
filebuffer | ||
error.go | ||
file_unix_test.go | ||
file_unix.go | ||
file_windows.go | ||
io.go | ||
legacy_test.go | ||
legacy.go | ||
paginate_test.go | ||
paginate.go | ||
path_test.go | ||
path.go | ||
remove.go | ||
sanitize_test.go | ||
sanitize.go | ||
sec_to_time_test.go | ||
sec_to_time.go | ||
shellquote_test.go | ||
shellquote.go | ||
slice_test.go | ||
slice.go | ||
string_test.go | ||
string.go | ||
timer.go | ||
truncate_test.go | ||
truncate.go | ||
url.go | ||
util_test.go | ||
util.go |