maze-solver-go/utils/utils.go
Karma Riuk e2b0b09636 Added min function to utils to get min between two
comparable types (how isn't it in the STL?)
2023-08-05 16:15:54 +02:00

22 lines
261 B
Go

package utils
import (
"log"
"golang.org/x/exp/constraints"
)
func Check(err error, msg string, args ...any) {
if err != nil {
log.Printf(msg, args...)
panic(err)
}
}
func Min[T constraints.Ordered](a, b T) T {
if a < b {
return a
}
return b
}