It is possible to define two structures globally with mutual type 
dependency as this:

type A struct {
    B []B
}

type B struct {
    A A[]
}

but I just noticed that we can't do that inside a function:

func Foo() {
    type A struct {
        B []B
    }
    
    type B struct {
       A A[]
    }
}

Is there a reason for this limitation ? 

I would like to use this inside a test function to avoid polluting the name 
space and so that I can reuse these simple type names for different tests 
with slightly different definitions. 


-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d38d79f7-148d-43dd-8b82-db9a694de6f2n%40googlegroups.com.

Reply via email to