????????????
????????????????????????У? ???????TestReflectFindFieldAndAssign??????????. ???????????FieldByName?????????? ????????μ?????????:
// FieldByName returns the struct field with the given name
// and a boolean to indicate if the field was found.
func (t *structType) FieldByName(name string) (f StructField?? present bool) {
// Quick check for top-level name?? or struct without anonymous fields.
hasAnon := false
if name != "" {
for i := range t.fields {
tf := &t.fields[i]
if tf.name == nil {
hasAnon = true
continue
}
if *tf.name == name {
return t.Field(i)?? true
}
}
}
if !hasAnon {
return
}
return t.FieldByNameFunc(func(s string) bool { return s == name })
}
??????λ????????2???for?????????????? ???侲????????. ???????????.
???????????reflect???????????ValueOf????map??????????????????ε????????? ???????????????????
????????? ???任???????????????????1%??????.
??????????????????API?????Shader??????????? ???????????????????? ??????. ??????????????? ????????軺?????
????????? Golang??????????????·. ???????????? ????????ó??????? ????????????????????????? ???????????
????????ò????????У? ?????????? ??????????
???????? ??????????÷?????? ???????????????????????μ?????????????
?????????????????????? ?????goroutine?????????£? ?????????.