summaryrefslogtreecommitdiff
path: root/reflect.go
diff options
context:
space:
mode:
Diffstat (limited to 'reflect.go')
-rw-r--r--reflect.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/reflect.go b/reflect.go
index e113583..f1e8e8d 100644
--- a/reflect.go
+++ b/reflect.go
@@ -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)
+}