// NewLiteralFieldSet creates and returns a reference to an empty set.
168231
func NewLiteralFieldSet(a ...LiteralField) LiteralFieldSet {
	s := make(LiteralFieldSet)
	for _, i := range a {
		s.Add(i)
	}
	return s
}
455000
func newAnnotations(in map[string]interface{}) (out map[AnnotationKey]interface{}) {
	if len(in) == 0 {
		return nil
	}
	out = make(map[AnnotationKey]interface{})
	for k, v := range in {
		out[AnnotationKeyString(k)] = v
	}
	return
}
1090780
func NewBooleanFieldMapping() *FieldMapping {
	return &FieldMapping{
		Type:         "boolean",
		Store:        true,
		Index:        true,
		IncludeInAll: true,
		DocValues:    true,
	}
}
520905
func newHealFormatSets(refFormat *formatXLV3, setCount, disksPerSet int, formats []*formatXLV3, errs []error) [][]*formatXLV3 {
	newFormats := make([][]*formatXLV3, setCount)
	for i := range refFormat.XL.Sets {
		newFormats[i] = make([]*formatXLV3, disksPerSet)
	}
	for i := range refFormat.XL.Sets {
		for j := range refFormat.XL.Sets[i] {
			if errs[i*disksPerSet+j] == errUnformattedDisk || errs[i*disksPerSet+j] == nil {
				newFormats[i][j] = &formatXLV3{}
				newFormats[i][j].Version = refFormat.Version
				newFormats[i][j].ID = refFormat.ID
				newFormats[i][j].Format = refFormat.Format
				newFormats[i][j].XL.Version = refFormat.XL.Version
				newFormats[i][j].XL.DistributionAlgo = refFormat.XL.DistributionAlgo
			}
			if errs[i*disksPerSet+j] == errUnformattedDisk {
				newFormats[i][j].XL.This = ""
				newFormats[i][j].XL.Sets = nil
				continue
			}
			if errs[i*disksPerSet+j] == nil {
				newFormats[i][j].XL.This = formats[i*disksPerSet+j].XL.This
				newFormats[i][j].XL.Sets = nil
			}
		}
	}
	return newFormats
}
727948
func NewFieldPath(name string, moreNames ...string) *FieldPath {
	r := &FieldPath{name: name, parent: nil}
	for _, anotherName := range moreNames {
		r = &FieldPath{name: anotherName, parent: r}
	}
	return r
}
740593
func (a *ArgType) TemplateSet() *TemplateSet {
	if a.templateSet == nil {
		a.templateSet = &TemplateSet{
			funcs: a.NewTemplateFuncs(),
			l:     a.TemplateLoader,
			tpls:  map[string]*template.Template{},
		}
	}

	return a.templateSet
}
203221
func New(fieldSeparators, quotes []rune, escape rune) Scanner {
	return &scanner{
		splitter{
			fieldSeparators: fieldSeparators,
			quotes:          quotes,
			esc:             escape,
			noesc:           utf8.RuneError, // assume shouldn't exist
		},
	}
}
394155
func NewSet(items ...interface{}) Set {
	res := setImpl{
		data: make(map[interface{}]struct{}),
	}
	for _, item := range items {
		res.Add(item)
	}
	return res
}
416405
func NewRuleset() *Ruleset {
	rs := new(Ruleset)
	rs.uncountables = make(map[string]bool)
	rs.plurals = make([]*Rule, 0)
	rs.singulars = make([]*Rule, 0)
	rs.humans = make([]*Rule, 0)
	rs.acronyms = make([]*Rule, 0)
	return rs
}
368629
func (scope *Scope) InstanceSet(name string, value interface{}) *Scope {
	return scope.Set(name+scope.InstanceID(), value)
}
1129824
func (s StringSet) AddSet(newValues StringSet) {
	for newValue, _ := range newValues {
		s[newValue] = struct{}{}
	}
}
185365
func OptFieldTypeSet(cacheType string, cacheSize uint32) FieldOption {
	return func(fo *FieldOptions) error {
		if fo.Type != "" {
			return errors.Errorf("field type is already set to: %s", fo.Type)
		}
		fo.Type = FieldTypeSet
		fo.CacheType = cacheType
		fo.CacheSize = cacheSize
		return nil
	}
}
1281433
func setEmptyFieldsFromActual(requested, actual interface{}, fields ...string) error {
	requestedValue := reflect.ValueOf(requested).Elem()
	actualValue := reflect.ValueOf(actual).Elem()

	if requestedValue.Type() != actualValue.Type() {
		return errors.Errorf("attempted to set fields from different types: %q from %q",
			requestedValue, actualValue)
	}

	for _, field := range fields {
		requestedField := requestedValue.FieldByName(field)
		if !requestedField.IsValid() {
			return errors.Errorf("no such field %q to cleanup", field)
		}
		actualField := actualValue.FieldByName(field)
		if !actualField.IsValid() {
			return errors.Errorf("no such field %q to cleanup", field)
		}

		if reflect.DeepEqual(requestedField.Interface(), reflect.Zero(requestedField.Type()).Interface()) {
			requestedField.Set(actualField)
		}
	}

	return nil
}
971861
func NewField(title, value string) *Field {
	return &Field{Title: title, Value: value, Short: len(value) < ShortFieldLen}
}
721367
func fieldSet(field *structs.Field, v string) error {
	switch f := field.Value().(type) {
	case flag.Value:
		if v := reflect.ValueOf(field.Value()); v.IsNil() {
			typ := v.Type()
			if typ.Kind() == reflect.Ptr {
				typ = typ.Elem()
			}

			if err := field.Set(reflect.New(typ).Interface()); err != nil {
				return err
			}

			f = field.Value().(flag.Value)
		}

		return f.Set(v)
	}

	// TODO: add support for other types
	switch field.Kind() {
	case reflect.Bool:
		val, err := strconv.ParseBool(v)
		if err != nil {
			return err
		}

		if err := field.Set(val); err != nil {
			return err
		}
	case reflect.Int:
		i, err := strconv.Atoi(v)
		if err != nil {
			return err
		}

		if err := field.Set(i); err != nil {
			return err
		}
	case reflect.String:
		if err := field.Set(v); err != nil {
			return err
		}
	case reflect.Slice:
		switch t := field.Value().(type) {
		case []string:
			if err := field.Set(strings.Split(v, ",")); err != nil {
				return err
			}
		case []int:
			var list []int
			for _, in := range strings.Split(v, ",") {
				i, err := strconv.Atoi(in)
				if err != nil {
					return err
				}

				list = append(list, i)
			}

			if err := field.Set(list); err != nil {
				return err
			}
		default:
			return fmt.Errorf("multiconfig: field '%s' of type slice is unsupported: %s (%T)",
				field.Name(), field.Kind(), t)
		}
	case reflect.Float64:
		f, err := strconv.ParseFloat(v, 64)
		if err != nil {
			return err
		}

		if err := field.Set(f); err != nil {
			return err
		}
	case reflect.Int64:
		switch t := field.Value().(type) {
		case time.Duration:
			d, err := time.ParseDuration(v)
			if err != nil {
				return err
			}

			if err := field.Set(d); err != nil {
				return err
			}
		case int64:
			p, err := strconv.ParseInt(v, 10, 0)
			if err != nil {
				return err
			}

			if err := field.Set(p); err != nil {
				return err
			}
		default:
			return fmt.Errorf("multiconfig: field '%s' of type int64 is unsupported: %s (%T)",
				field.Name(), field.Kind(), t)
		}

	default:
		return fmt.Errorf("multiconfig: field '%s' has unsupported type: %s", field.Name(), field.Kind())
	}

	return nil
}
842315
func FieldSet(name string, elems ...fields.FieldInterface) *FieldSetType {
	ret := &FieldSetType{
		tmpl:       "fieldset",
		name:       name,
		class:      map[string]struct{}{},
		tags:       map[string]struct{}{},
		fields:     elems,
		fieldMap:   map[string]int{},
		AppendData: map[string]interface{}{},
	}
	for i, elem := range elems {
		ret.fieldMap[elem.Name()] = i
	}
	return ret
}
206402
func NewFieldFromReader(name string, reader io.RuneReader, ft *FieldType) *Field {
	assert2(name != "", "name cannot be empty")
	assert2(ft != nil, "type can not be nil")
	assert2(reader != nil, "reader cannot be nil")
	assert2(!ft.Stored(), "fields with a Reader value cannot be stored")
	assert2(!ft.Indexed() || ft.Tokenized(), "non-tokenized fields must use String values")
	return &Field{ft, name, reader, 1.0, nil}
}