使用反射模拟struct.field

How can I get the same value as reflect.TypeOf(struct.field) when using FieldByName when the field is an interface type?

As seen here, if a struct field is an interface, reflect.TypeOf(struct.field) gives me the concrete type, but reflect.ValueOf(struct).FieldByName("field").Type() gives me the interface. Is it possible to get the concrete type stored in struct.field using reflect if all I have is struct and "field"?

You should use Elem()

// Elem returns the value that the interface v contains

Correct way to extract the type

reflect.ValueOf(h).Elem().FieldByName("i").Elem().Type().String()