Just read https://go101.org/article/type-embedding.html

The full form of the EqualName field is meter.EqualName,
the full form of the EqualName method is mete.EqualName.EqualName.

The longer one is shadowed by the shorter one.

func main() {
impl := new(impl)

var m = &meter{
EqualName: impl,
}

fmt.Printf("%T\n", m.EqualName) // *main.impl
}

On Friday, February 28, 2025 at 1:06:59 AM UTC+8 cpu...@gmail.com wrote:

> About every single time I feel like I understand Go interfaces I'm being 
> taught differently.
>
> Consider this play: https://play.golang.com/p/qeF4KvaPcwp
>
> There are 2 single method interfaces. One where interface and method names 
> are equal, one where they are different.
>
> I would have expected m to implement both interfaces, but it doesn't. Why 
> is that?
>
> Thanks,
> Andi
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/f05615b8-421d-4e77-becd-1439af02b5c6n%40googlegroups.com.

Reply via email to