reflect: add type check to Value.Field()
Этот коммит содержится в:
родитель
069c397975
коммит
584a2718d0
1 изменённых файлов: 3 добавлений и 0 удалений
|
@ -568,6 +568,9 @@ func (v Value) Elem() Value {
|
|||
|
||||
// Field returns the value of the i'th field of this struct.
|
||||
func (v Value) Field(i int) Value {
|
||||
if v.Kind() != Struct {
|
||||
panic(&ValueError{Method: "Field", Kind: v.Kind()})
|
||||
}
|
||||
structField := v.typecode.rawField(i)
|
||||
flags := v.flags
|
||||
if structField.PkgPath != "" {
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче