MCPcopy
hub / github.com/go-yaml/yaml / fieldByIndex

Method fieldByIndex

encode.go:197–212  ·  view source on GitHub ↗
(v reflect.Value, index []int)

Source from the content-addressed store, hash-verified

195}
196
197func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field reflect.Value) {
198 for _, num := range index {
199 for {
200 if v.Kind() == reflect.Ptr {
201 if v.IsNil() {
202 return reflect.Value{}
203 }
204 v = v.Elem()
205 continue
206 }
207 break
208 }
209 v = v.Field(num)
210 }
211 return v
212}
213
214func (e *encoder) structv(tag string, in reflect.Value) {
215 sinfo, err := getStructInfo(in.Type())

Callers 1

structvMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected