From 18f9120c8c1e0fb37479361973ee35408a10fe94 Mon Sep 17 00:00:00 2001 From: gutmet Date: Sat, 22 Dec 2018 20:12:34 +0100 Subject: [PATCH] add OptPanic --- goutil.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/goutil.go b/goutil.go index 8ce4477..3db56d1 100644 --- a/goutil.go +++ b/goutil.go @@ -104,6 +104,12 @@ func OptDo(err error, f func() error) error { } } +func OptPanic(err error) { + if err != nil { + panic(err) + } +} + func IntMin(x, y int) int { if x < y { return x