diff options
Diffstat (limited to 'reflect.go')
| -rw-r--r-- | reflect.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3,6 +3,8 @@ package arg import ( "encoding" "reflect" + "unicode" + "unicode/utf8" scalar "github.com/alexflint/go-scalar" ) @@ -60,3 +62,9 @@ func isBoolean(t reflect.Type) bool { return false } } + +// isExported returns true if the struct field name is exported +func isExported(field string) bool { + r, _ := utf8.DecodeRuneInString(field) // returns RuneError for empty string or invalid UTF8 + return unicode.IsLetter(r) && unicode.IsUpper(r) +} |
