]> Cypherpunks repositories - gostls13.git/commit
reflect: add FieldByIndexErr
authorRob Pike <r@golang.org>
Sun, 24 Oct 2021 03:11:07 +0000 (14:11 +1100)
committerRob Pike <r@golang.org>
Fri, 29 Oct 2021 02:11:42 +0000 (02:11 +0000)
commit33c392f72d16163eb0795b3d61b2196ac21e1799
tree2121c6ed2c08c00b93f3eec8f27d950dae6c1091
parentaf05d8be3d9dd566b2ce3ff5344258314f128ff6
reflect: add FieldByIndexErr

This new function, although different in signature from other
reflect functions, allows the caller to avoid the panic caused by
nil embedded fields in calls to FieldByIndex.

Fixes #48218

Change-Id: I447f135bb789148c27ae3f2f23dcf43094f4c1de
Reviewed-on: https://go-review.googlesource.com/c/go/+/357962
Trust: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/reflect/value.go
src/reflect/visiblefields_test.go