diff --git a/pwgen.go b/pwgen.go index a7321c0..48ebbba 100644 --- a/pwgen.go +++ b/pwgen.go @@ -18,6 +18,14 @@ func Generate(opts ...GenerationOption) (string, error) { return Default.Generate(opts...) } +func MustGenerate(opts ...GenerationOption) string { + if pw, err := Generate(opts...); err != nil { + panic(err) + } else { + return pw + } +} + func NewDefaultGenerator(prng Int32n) DefaultGenerator { if prng == nil { prng = rand.New(rand.NewSource(time.Now().UnixNano()))