diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-06-05 18:01:39 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-06-05 18:01:39 +0100 |
| commit | 0315338ef5c5fadd739088684323b82535fc904b (patch) | |
| tree | c7febbf73ef122cd7c46f3e6e81c09432c8d4987 /util.go | |
| parent | 326a741c1298959e5d6e5eb1a6b2225ef9151063 (diff) | |
Add Listen, Must, PipeListener, and T
Diffstat (limited to 'util.go')
| -rw-r--r-- | util.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -0,0 +1,9 @@ +package core + +// Must panics if err is not nil. It returns val otherwise. +func Must[T any](val T, err error) T { + if err != nil { + panic(err) + } + return val +} |
