• Pravendra Singh's avatar
    reflect: prevent structs with invalid field name · 538b3a5f
    Pravendra Singh authored
    According to the language spec, a struct field name should
    be an identifier.
    
      identifier = letter { letter | unicode_digit } .
      letter = unicode_letter | "_" .
    
    Implements a function 'isValidFieldName(fieldName string) bool'.
    To check if the field name is a valid identifier or not.
    It will panic if the field name is invalid.
    
    It uses the non-exported function implementation 'isLetter'
    from the package 'scanner', used to parse an identifier.
    
    Fixes #20600.
    
    Change-Id: I1db7db1ad88cab5dbea6565be15cc7461cc56c44
    Reviewed-on: https://go-review.googlesource.com/45590Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    538b3a5f
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...