type Controller struct{}
func (c *Controller) ServeHTTP(w, r) {
v := reflect.ValueOf(c)
m := v.MethodByName("GET") // 獲取不到 IndexController 的 GET
}
Go **無繼承**,`IndexController` 嵌入 `Controller` 是 **組合**。`reflect.ValueOf(c)` 的類型是 `*Controller`,**方法集只包含 Controller 定義的方法**,不包含嵌入類型提升的方法 (提升方法屬於外層類型 `*IndexController`)。
type Handler interface { GET() }
func (c *Controller) ServeHTTP(w, r) {
if h, ok := c.(Handler); ok { h.GET() }
}