diff options
| author | Alex Flint <[email protected]> | 2021-01-31 19:20:28 -0800 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2021-01-31 19:20:28 -0800 |
| commit | 2a91531140cfb74c2fc889d80d4e0b50ea4906dd (patch) | |
| tree | 0d822d3d0962649bc6d9bb08575457dc513ef30f /reflect.go | |
| parent | 788c166025870bc4653adb5986d03f99c1d14af2 (diff) | |
| parent | 2a23168641ed1fb55f5f4dc72f50bdf15cb65b27 (diff) | |
Merge remote-tracking branch 'origin/master' into optional-long
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) +} |
