]> 127.0.0.1 Git - part/.git/commitdiff
1 (#40) v0.28.20250330161202
authorqydysky <qydysky@foxmail.com>
Sun, 30 Mar 2025 16:11:54 +0000 (00:11 +0800)
committerGitHub <noreply@github.com>
Sun, 30 Mar 2025 16:11:54 +0000 (00:11 +0800)
component2/comp.go

index 5d150e64735eaf0239f264a2808eee1d22f3503f..d87639b1577d03b3f8795360f417334e2a967bb6 100644 (file)
@@ -35,6 +35,12 @@ func Register[TargetInterface any](id string, _interface TargetInterface) error
        return nil
 }
 
+func RegisterOrPanic[TargetInterface any](id string, _interface TargetInterface) {
+       if e := Register(id, _interface); e != nil {
+               panic(e)
+       }
+}
+
 func Get[TargetInterface any](id string, prefunc ...PreFunc[TargetInterface]) (_interface TargetInterface) {
        if len(prefunc) == 0 {
                prefunc = append(prefunc, PreFuncErr[TargetInterface]{})