mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
feat(api): remove golang experimental packages [EE-3648] (#8081)
* remove golang experimental packages * rebase and fix references
This commit is contained in:
parent
dffd45c5f9
commit
3e485c3152
5 changed files with 26 additions and 7 deletions
22
api/internal/slices/slices.go
Normal file
22
api/internal/slices/slices.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package slices
|
||||
|
||||
// Contains is a generic function that returns true if the element is contained within the slice
|
||||
func Contains[T comparable](elems []T, v T) bool {
|
||||
for _, s := range elems {
|
||||
if v == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IndexFunc returns the first index i satisfying f(s[i]),
|
||||
// or -1 if none do.
|
||||
func IndexFunc[E any](s []E, f func(E) bool) int {
|
||||
for i, v := range s {
|
||||
if f(v) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue