// Must is a helper that wraps a call to a function returning
// (*Template, error) and panics if the error is non-nil. It is intended for
// use in variable initializations such as
//	var t = template.Must(template.New("name").Parse("templates/my.tmpl"))
480518
func Must(t *Template, err error) *Template {
	if err != nil {
		panic(fmt.Sprintf("template error: %s", err))
	}
	if t == nil {
		panic(fmt.Sprintf("template was nil"))
	}
	return t
}
26824
func require(required []string, parser lineParser) lineParser {
	f := func(ctx *parseContext, cmd string, args []string) (node, error) {
		n, err := parser(ctx, cmd, args)
		if err == nil {
			requiredMap := make(map[string]bool)
			for _, r := range required {
				requiredMap[r] = false //hasn't been found yet
			}

			for _, previousNode := range ctx.nodes {
				if _, found := requiredMap[previousNode.cmd]; found {
					requiredMap[previousNode.cmd] = true
				}
			}
			for key, found := range requiredMap {
				if !found {
					ctx.addErrorf("line %d: %s depends on %s", ctx.lineNum, cmd, key)
				}
			}
		}
		return n, err
	}
	return f
}
214094
func (templateStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
	return validation.ValidateTemplate(obj.(*templateapi.Template))
}
1262779
func (d *Decoder) mustDecode(v interface{}) {
	// TODO: Top-level: ensure that v is a pointer and not nil.
	if d.d.TryDecodeAsNil() {
		setZero(v)
		return
	}
	if d.bi == nil {
		d.decode(v)
		return
	}

	d.bi.calls++
	d.decode(v)
	// xprintf.(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn)
	d.bi.calls--
	if !d.h.ExplicitRelease && d.bi.calls == 0 {
		d.bi.release()
	}
}
236236
func MustLoad(filenames ...string) {
	err := Load(filenames...)
	if err != nil {
		panic(err.Error())
	}
}
550204
func MustParse(args ...string) Value {
	v, err := Parse(args...)
	if err != nil {
		panic(err)
	}
	return v
}
344550
func Required(names ...string) {
	var at *design.AttributeDefinition

	switch def := dslengine.CurrentDefinition().(type) {
	case *design.AttributeDefinition:
		at = def
	case *design.MediaTypeDefinition:
		at = def.AttributeDefinition
	default:
		dslengine.IncompatibleDSL()
		return
	}

	if at.Type != nil && at.Type.Kind() != design.ObjectKind {
		incompatibleAttributeType("required", at.Type.Name(), "an object")
	} else {
		if at.Validation == nil {
			at.Validation = &dslengine.ValidationDefinition{}
		}
		at.Validation.AddRequired(names)
	}
}
636014
func (o *OnlyExcept) Validate(t *Template) error {
	if len(o.Only) > 0 && len(o.Except) > 0 {
		return errors.New("only one of 'only' or 'except' may be specified")
	}

	var err error
	for _, n := range o.Only {
		if _, ok := t.Builders[n]; !ok {
			err = multierror.Append(err, fmt.Errorf(
				"'only' specified builder '%s' not found", n))
		}
	}
	for _, n := range o.Except {
		if _, ok := t.Builders[n]; !ok {
			err = multierror.Append(err, fmt.Errorf(
				"'except' specified builder '%s' not found", n))
		}
	}

	return err
}
1006309
func Required(field *Path, detail string) *Error {
	return &Error{ErrorTypeRequired, field.String(), "", detail}
}
1040488
func need(m, max, extra int) (int, int, int) {
	if m <= extra {
		return m, max, extra - m
	}
	max += extra - m
	if max <= 0 {
		return m + max, 0, 0
	}
	return m, max, 0
}
387559
func MustRegexp(expr string) func(string) bool {
	r, err := Regexp(expr)
	if err != nil {
		panic(err)
	}
	return r
}
613369
func MustCallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) {
	r, err := CallMethod(disp, name, params...)
	if err != nil {
		panic(err.Error())
	}
	return r
}
1043928
func (e ParameterRequiredError) Error() string {
	return fmt.Sprintf(`"%s" is required in "%s"`, e.ParameterName, e.ParentName)
}
174703
func (j *Json) MustMap(args ...map[string]interface{}) map[string]interface{} {
	var def map[string]interface{}

	switch len(args) {
	case 0:
	case 1:
		def = args[0]
	default:
		log.Panicf("MustMap() received too many arguments %d", len(args))
	}

	a, err := j.Map()
	if err == nil {
		return a
	}

	return def
}
633435
func (d *Context) RequireFunction(index int) {
	C.duk_require_function(d.duk_context, C.duk_idx_t(index))
}
891886
func MustString(input interface{}) string {
	output, err := String(input)
	if err != nil {
		panic(err)
	}
	return output
}
23568
func (d *DefaultLoader) MustValidate(conf interface{}) {
	if err := d.Validate(conf); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(2)
	}
}