frostfs-api-go/util/collection/slice.go
Dmitrii Stepanov d005bf0393 [#3] signature: Refactor sign and verify
Split methods to separate files, drop redundant intefaces

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-03-10 13:36:26 +03:00

17 lines
342 B
Go

package collection
import "golang.org/x/exp/constraints"
// Max finds maximum value of items.
func Max[T constraints.Ordered](items ...T) T {
if len(items) == 0 {
panic("failed to get max value: empty slice")
}
result := items[0]
for i := 1; i < len(items); i++ {
if items[i] > result {
result = items[i]
}
}
return result
}