grafana/pkg/util/reverse.go
Sofia Papagiannaki 5c973e58bd
Nested Folders: Add tests for store methods (#57662)
* Nested Folders: Add store tests

* Fix parent order

* Fix update

* skip tests!

* Export test helpers for now
2022-11-03 14:21:41 +01:00

11 lines
241 B
Go

package util
// Reverse returns a new slice with reversed order
func Reverse[T comparable](input []T) []T {
output := make([]T, 0, len(input))
for i := len(input) - 1; i >= 0; i-- {
output = append(output, input[i])
}
return output
}