refactor: migrate 'flowutils' to 'must' helpers

This commit is contained in:
2026-09-08 15:15:28 -07:00
parent cf989f7433
commit f542f45630
8 changed files with 66 additions and 59 deletions

27
pkg/must/must.go Normal file
View File

@@ -0,0 +1,27 @@
package must
import (
"fmt"
"io"
)
func Do(err error) {
if err != nil {
panic(err)
}
}
func Get[T any](val T, err error) T {
Do(err)
return val
}
func Be(condition bool, msg string, args ...any) {
if !condition {
panic(fmt.Errorf(msg, args...)) //nolint:err113 // not a returned error
}
}
func Close(closer io.Closer) {
Do(closer.Close())
}