Godeps/_workspace/src/gopkg.in/bluesuncorp/validator.v5/validator.go
func (e *StructErrors) Flatten() map[string]*FieldError {

	if e == nil {
		return nil
	}

	errs := map[string]*FieldError{}

	for _, f := range e.Errors {

		if flat := f.Flatten(); flat != nil && len(flat) > 0 {

			for k, fe := range flat {

				if f.IsPlaceholderErr {
					errs[f.Field+k] = fe
				} else {
					errs[k] = fe
				}
			}
		}
	}

	for key, val := range e.StructErrors {

		otherErrs := val.Flatten()

		for _, f2 := range otherErrs {

			f2.Field = fmt.Sprintf("%s.%s", key, f2.Field)
			errs[f2.Field] = f2
		}
	}

	return errs
}
func (e *StructErrors) Flatten() map[string]*FieldError {

	if e == nil {
		return nil
	}

	errs := map[string]*FieldError{}

	for _, f := range e.Errors {

		if flat := f.Flatten(); flat != nil && len(flat) > 0 {

			for k, fe := range flat {

				if f.IsPlaceholderErr {
					errs[f.Field+k] = fe
				} else {
					errs[k] = fe
				}
			}
		}
	}

	for key, val := range e.StructErrors {

		otherErrs := val.Flatten()

		for _, f2 := range otherErrs {

			f2.Field = fmt.Sprintf("%s.%s", key, f2.Field)
			errs[f2.Field] = f2
		}
	}

	return errs
}
func ( e * StructErrors ) Flatten ( ) map [ string ] * FieldError { if e == nil { return nil } errs := map [ string ] * FieldError { } for _ , f := range e . Errors { if flat := f . Flatten ( ) ; flat != nil && len ( flat ) > 0 { for k , fe := range flat { if f . IsPlaceholderErr { errs [ f . Field + k ] = fe } else { errs [ k ] = fe } } } } for key , val := range e . StructErrors { otherErrs := val . Flatten ( ) for _ , f2 := range otherErrs { f2 . Field = fmt . Sprintf ( " " , key , f2 . Field ) errs [ f2 . Field ] = f2 } } return errs }
// Flatten flattens the StructErrors hierarchical structure into a flat namespace style field name
// for those that want/need it
Flatten flattens the StructErrors hierarchical structure into a flat namespace style field name for those that want / need it