From 94e1712122fb647ebf8ec1ffd9f44e9921ce5c3d Mon Sep 17 00:00:00 2001 From: Samantha Becker <12024604-beckersam@users.noreply.gitlab.com> Date: Fri, 18 Aug 2023 17:14:04 +0200 Subject: [PATCH] Added Must func to other --- pkg/other/other.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/other/other.go b/pkg/other/other.go index ebc1c3a..98e940e 100644 --- a/pkg/other/other.go +++ b/pkg/other/other.go @@ -6,3 +6,10 @@ package other func OutputIntoChannel[T any](out T, target chan T) { target <- out } + +func Must[T any](val T, err error) T { + if err != nil { + panic(err) + } + return val +}