我断言指向结构的指针的类型是在golang中实现接口,下面的代码示例中有一些我不理解的地方:

package main

import (
    "fmt"
)

type MyStruct struct {
    Name string
}

func (m *MyStruct) MyFunc() {
    m.Name = "bar"
}

type MyInterface interface {
    MyFunc()
}

func main() {
    x := &MyStruct{
        Name: "foo",
    }
    var y interface{}
    y = x
    _, ok := y.(MyInterface)
    if !ok {
        fmt.Println("Not MyInterface")
    } else {
        fmt.Println("It is MyInterface")
    }
}
_, ok := y.(*MyInterface)yMyStruct