]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: document that StructOf panics on unexported fields
authorAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 29 May 2018 12:36:28 +0000 (14:36 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 29 May 2018 17:06:37 +0000 (17:06 +0000)
Fixes #25401

Change-Id: I0b61ecfcee43ebfe0a84b5c1e28a3817f96b94ed
Reviewed-on: https://go-review.googlesource.com/115015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/reflect/type.go

index a78b20d8f49e3d8bc825e700b7639de01813b0b7..1f3b665ce4da9f61b5edaaea266903a440d87d2b 100644 (file)
@@ -2345,8 +2345,9 @@ func isValidFieldName(fieldName string) bool {
 // The Offset and Index fields are ignored and computed as they would be
 // by the compiler.
 //
-// StructOf currently does not generate wrapper methods for embedded fields.
-// This limitation may be lifted in a future version.
+// StructOf currently does not generate wrapper methods for embedded
+// fields and panics if passed unexported StructFields.
+// These limitations may be lifted in a future version.
 func StructOf(fields []StructField) Type {
        var (
                hash       = fnv1(0, []byte("struct {")...)