diff --git a/util/must/must.go b/util/must/must.go index e195f017d..55abf0db0 100644 --- a/util/must/must.go +++ b/util/must/must.go @@ -5,11 +5,20 @@ // Package must assists in calling functions that must succeed. // // Example usage: -// var target = must.Do(url.Parse(...)) +// +// var target = must.Get(url.Parse(...)) +// must.Do(close()) package must -// Do returns v as is. It panics if err is non-nil. -func Do[T any](v T, err error) T { +// Do panics if err is non-nil. +func Do(err error) { + if err != nil { + panic(err) + } +} + +// Get returns v as is. It panics if err is non-nil. +func Get[T any](v T, err error) T { if err != nil { panic(err) }