No, it is not currently possible to do
this, https://play.golang.org/p/S8w_ztCobQ
On Tuesday, 13 December 2016 12:08:52 UTC+11, go-question wrote:
>
>
> I noticed that its possible to define/scope types/interfaces in functions.
>
> Now I'm not arguing that this is good practice, but for the sake of
> curiosity.
> How can I then add a method w/ a receiver to type foo so that it satisfies
> interface ifoo? (in function scope)
>
>
> func main() {
>
> type foo struct{
> a string
> }
>
> type ifoo interface {
> Bar()
> }
>
> // possible?
> foo{"baz"}.Bar()
>
> }
>
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.