mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: correct Type.FieldByNameFunc docs
Fixes #16573. Change-Id: I5a26eaa8b258cb1861190f9690086725532b8a0d Reviewed-on: https://go-review.googlesource.com/31354 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
e65bce7144
commit
e05d014048
1 changed files with 6 additions and 1 deletions
|
|
@ -156,9 +156,14 @@ type Type interface {
|
||||||
// and a boolean indicating if the field was found.
|
// and a boolean indicating if the field was found.
|
||||||
FieldByName(name string) (StructField, bool)
|
FieldByName(name string) (StructField, bool)
|
||||||
|
|
||||||
// FieldByNameFunc returns the first struct field with a name
|
// FieldByNameFunc returns the struct field with a name
|
||||||
// that satisfies the match function and a boolean indicating if
|
// that satisfies the match function and a boolean indicating if
|
||||||
// the field was found.
|
// the field was found.
|
||||||
|
//
|
||||||
|
// If multiple fields match the func, they cancel each other
|
||||||
|
// and FieldByNameFunc returns no match.
|
||||||
|
// This behavior mirrors Go's handling of name lookup in
|
||||||
|
// structs containing anonymous fields.
|
||||||
FieldByNameFunc(match func(string) bool) (StructField, bool)
|
FieldByNameFunc(match func(string) bool) (StructField, bool)
|
||||||
|
|
||||||
// In returns the type of a function type's i'th input parameter.
|
// In returns the type of a function type's i'th input parameter.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue