// Set sets the enum value. If s is not a valid enum value, an error is
// returned.
962866
func (f *EnumFlag) Set(s string) error {
	for i := range f.vs {
		if f.vs[i] == s {
			f.i = i
			return nil
		}
	}
	return fmt.Errorf("must be one of %v", f.Type())
}
684254
func (ia *IntValue) Set(s string) error {
	i, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		return err
	}
	*ia = IntValue(int(i))
	return nil
}
975170
func (r *MemoryNoTS) Set(key string, value interface{}) error {
	r.items[key] = value
	return nil
}
595261
func (s *SeverityFlag) Set(value string) error {
	sev, err := log.ParseLevel(strings.ToLower(value))
	if err != nil {
		return err
	}
	s.S = sev
	return nil
}
316503
func (ns *Namespaces) Set(str string) error {
	fargs := func(c rune) bool {
		return c == ',' || c == ';'
	}
	// get function
	slice := strings.FieldsFunc(str, fargs)
	*ns = append(*ns, slice...)
	return nil
}
730308
func (v *Value) Set(s string) error {
	b, err := DecodeString(s)
	if err != nil {
		return err
	}
	*v = b
	return nil
}
6653
func (p *IntParam) Set(s string) error {
	v, err := strconv.ParseInt(s, 0, 64)
	if err != nil {
		return err
	}
	p.val = &v
	return nil
}
286431
func (c *Strings) Set(value string) error {
	*c = append(*c, value)
	return nil
}
839987
func (e *Env) Set(k string, v interface{}) error {
	if v == nil {
		return e.setValue(k, nilValue)
	}
	return e.setValue(k, reflect.ValueOf(v))
}
674374
func (p *KVParam) Set(s string) error {
	sep := p.sep()

	parts := strings.Split(s, sep)
	if len(parts) != len(p.keys) {
		return trace.Errorf(
			"expected elements separated by '%v', got '%v'", sep, s)
	}
	values := make([]Param, len(p.keys))
	for i, pt := range parts {
		el := p.keys[i].New()
		if err := el.Set(pt); err != nil {
			return err
		}
		values[i] = el
	}

	p.values = values
	return nil
}
237131
func (p *PathParam) Set(s string) error {
	p.val = &s
	return nil
}
67754
func set(dst, src reflect.Value) error {
	dstType, srcType := dst.Type(), src.Type()
	switch {
	case dstType.Kind() == reflect.Interface && dst.Elem().IsValid():
		return set(dst.Elem(), src)
	case dstType.Kind() == reflect.Ptr && dstType.Elem() != derefbigT:
		return set(dst.Elem(), src)
	case srcType.AssignableTo(dstType) && dst.CanSet():
		dst.Set(src)
	case dstType.Kind() == reflect.Slice && srcType.Kind() == reflect.Slice:
		return setSlice(dst, src)
	default:
		return fmt.Errorf("abi: cannot unmarshal %v in to %v", src.Type(), dst.Type())
	}
	return nil
}
216407
func (m stringMap) Set(s string) error {
	if *m.mapping == nil {
		*m.mapping = map[string]string{}
	}
	// make a copy so the following code is less ugly with dereferencing.
	mapping := *m.mapping

	vals := strings.SplitN(s, "=", 2)
	if len(vals) != 2 {
		return errors.NewNotValid(nil, "badly formatted name value pair: "+s)
	}
	name, value := vals[0], vals[1]
	if _, ok := mapping[name]; ok {
		return errors.Errorf("duplicate name specified: %q", name)
	}
	mapping[name] = value
	return nil
}
1358372
func (ns *NullString) Set(value interface{}) error {

	ns.valid = false
	ns.value = ""

	if value == nil {
		return nil
	}

	ns.valid = true
	ns.value = fmt.Sprint(value)

	return nil
}
1285703
func (s *Settings) Set(key, value string) {
	s.settings[key] = value
}
745953
func (s *AttributeValue) SetS(v string) *AttributeValue {
	s.S = &v
	return s
}
39900
func (option *Option) set(value *string) error {
	kind := option.value.Type().Kind()

	if (kind == reflect.Map || kind == reflect.Slice) && !option.isSet {
		option.empty()
	}

	option.isSet = true
	option.preventDefault = true

	if len(option.Choices) != 0 {
		found := false

		for _, choice := range option.Choices {
			if choice == *value {
				found = true
				break
			}
		}

		if !found {
			allowed := strings.Join(option.Choices[0:len(option.Choices)-1], ", ")

			if len(option.Choices) > 1 {
				allowed += " or " + option.Choices[len(option.Choices)-1]
			}

			return newErrorf(ErrInvalidChoice,
				"Invalid value `%s' for option `%s'. Allowed values are: %s",
				*value, option, allowed)
		}
	}

	if option.isFunc() {
		return option.call(value)
	} else if value != nil {
		return convert(*value, option.value, option.tag)
	}

	return convert("", option.value, option.tag)
}