Remix.run Logo
avanai 5 hours ago

    var _ MyInterface = &MyStruct{}

Now your compiler will tell you you stopped implementing the interface. Pretty? No. But it works. And gopls will even offer to implement stubs for missing methods.
pdmccormick 2 hours ago | parent | next [-]

This also works:

    var _ MyInterface = (*MyStruct)(nil)
In my mind as I read this, I am reminded that it is the receiver type *MyStruct that implements MyInterface. YMMV.
BadBadJellyBean 4 hours ago | parent | prev [-]

That is helpful but I think that is still a fail for Go. This could and should be a simple annotation.