I'm not sure what you mean. types that reference each others in a type declaration are allowed when declared globally , but not in a block ( ? )
i.e. : declaring Foo and Bar outside main would work , declaring them inside main doesn't . I wanted to declare them inside an example function in order for them to show up in the docs since the latter only prints the body of example functions (func ExampleFoo ...) . So I was asking why it worked that way. Since a type can only be declared once in a scope, the order in which they are declared shouldn't matter ? so they could reference each others like in my code snippet. thanks. Le lundi 28 novembre 2016 11:54:39 UTC+1, Jan Mercl a écrit : > > On Mon, Nov 28, 2016 at 11:46 AM <parais...@gmail.com <javascript:>> > wrote: > > > Is there an alternative aside from declaring types globally ? > > Unfortunately, the problem to solve is not defined, only the solution > tried and failed is, so I don't know if this can help: > https://play.golang.org/p/9btAagXDpM > > -- > > -j > -- 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. For more options, visit https://groups.google.com/d/optout.