• 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
..
all_test.go Loading commit data...
asm_386.s Loading commit data...
asm_amd64.s Loading commit data...
asm_amd64p32.s Loading commit data...
asm_arm.s Loading commit data...
asm_arm64.s Loading commit data...
asm_mips64x.s Loading commit data...
asm_mipsx.s Loading commit data...
asm_ppc64x.s Loading commit data...
asm_s390x.s Loading commit data...
deepequal.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
makefunc.go Loading commit data...
set_test.go Loading commit data...
swapper.go Loading commit data...
tostring_test.go Loading commit data...
type.go Loading commit data...
value.go Loading commit data...