Created
April 24, 2017 17:34
-
-
Save jblebrun/b81892bf78186ca2a74a4a4abfb292db to your computer and use it in GitHub Desktop.
Weird struct/interface nesting causes stack overflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
type Iface interface { | |
Method() | |
} | |
type Inner struct { | |
Iface | |
} | |
type Outer struct { | |
*Inner | |
} | |
func main() { | |
o := &Outer{&Inner{}} | |
o.Inner.Iface = o | |
o.Method() //Blamo! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment