2 ms·
Two functions solve this (in Go): func Must(err error) { if err != nil { panic(err) } } func Panic[T any](v T, err err
by jen20 3y ago
Two functions solve this (in Go):
func Must(err error) {
if err != nil {
panic(err)
}
}
func Panic[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}