예제 #1
0
// fieldSet sets field value from the given string value. It converts the
// string value in a sane way and is usefulf or environment variables or flags
// which are by nature in string types.
func fieldSet(field *structs.Field, s string) error {
	if err := field.Settable(); err != nil {
		return err
	}

	return setValue(field.ReflectValue(), s, field.Name())
}