aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2016-10-19 08:48:25 -0400
committerRuss Cox <rsc@golang.org>2016-10-19 13:32:51 +0000
commitf2f8d58b92cd7fd9616c98fb012467656de5a3cb (patch)
treed3450e27fc2b473d787c1f3a2af414730e818e62 /src
parent2f7f679c79009137bd34fcc33a6d3a6762f45e75 (diff)
downloadgo-f2f8d58b92cd7fd9616c98fb012467656de5a3cb.tar.xz
reflect: update FieldByNameFunc comment
This was supposed to be in CL 31354 but was dropped due to a Git usage error. For #16573. Change-Id: I3d99087c8efc8cbc016c55e8365d0005f79d1b2f Reviewed-on: https://go-review.googlesource.com/31461 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/reflect/type.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/reflect/type.go b/src/reflect/type.go
index a9793978f7..89e02bccd7 100644
--- a/src/reflect/type.go
+++ b/src/reflect/type.go
@@ -160,7 +160,11 @@ type Type interface {
// that satisfies the match function and a boolean indicating if
// the field was found.
//
- // If multiple fields match the func, they cancel each other
+ // FieldByNameFunc considers the fields in the struct itself
+ // and then the fields in any anonymous structs, in breadth first order,
+ // stopping at the shallowest nesting depth containing one or more
+ // fields satisfying the match function. If multiple fields at that depth
+ // satisfy the match function, they cancel each other
// and FieldByNameFunc returns no match.
// This behavior mirrors Go's handling of name lookup in
// structs containing anonymous fields.