2023-08-03 21:07:58 +02:00
|
|
|
package utils
|
|
|
|
|
2023-08-05 16:15:54 +02:00
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"golang.org/x/exp/constraints"
|
|
|
|
)
|
2023-08-03 21:07:58 +02:00
|
|
|
|
|
|
|
func Check(err error, msg string, args ...any) {
|
|
|
|
if err != nil {
|
|
|
|
log.Printf(msg, args...)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
2023-08-05 16:15:54 +02:00
|
|
|
|
|
|
|
func Min[T constraints.Ordered](a, b T) T {
|
|
|
|
if a < b {
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
return b
|
|
|
|
}
|