From ab364e19081b04ad94e1dfbcaa10423a0da57968 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Fri, 23 Jan 2015 13:57:43 +0700 Subject: [PATCH] Config includes all fields now unless field has "ignored" attribute --- config.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/config.go b/config.go index b9062f6..bb6bc90 100644 --- a/config.go +++ b/config.go @@ -86,17 +86,7 @@ loop_over_fields: } ) - if title != "" || len(attrs) > 0 || len(options) > 0 { - // Substitute field name for title if none set - if kind != reflect.Struct { - cf.Value = val.Interface() - } - if title == "" { - cf.Title = field.Name - } - if len(options) > 0 { - cf.Options = strings.Split(options, sep) - } + if len(attrs) > 0 { for _, attr := range strings.Split(attrs, sep) { if attr == aRequired { cf.IsRequired = true @@ -109,9 +99,21 @@ loop_over_fields: } } - fields = append(fields, cf) } + // Substitute field name for title if none set + if kind != reflect.Struct { + cf.Value = val.Interface() + } + if title == "" { + cf.Title = field.Name + } + if len(options) > 0 { + cf.Options = strings.Split(options, sep) + } + + fields = append(fields, cf) + // Recursion here if kind == reflect.Struct { subconf := &config{