aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'helper/args.go')
-rw-r--r--helper/args.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/helper/args.go b/helper/args.go
index c841fd36..f85d57ed 100644
--- a/helper/args.go
+++ b/helper/args.go
@@ -53,3 +53,14 @@ func NewCheckedArgs(args []string) (io.WriterTo, error) {
a := argsWt(args)
return a, a.check()
}
+
+// MustNewCheckedArgs returns a checked argument writer for args and panics if check fails.
+// Callers must not retain any references to args.
+func MustNewCheckedArgs(args []string) io.WriterTo {
+ a, err := NewCheckedArgs(args)
+ if err != nil {
+ panic(err.Error())
+ }
+
+ return a
+}