Skip to content

Instantly share code, notes, and snippets.

@jblebrun
Created April 24, 2017 17:34
Show Gist options
  • Save jblebrun/b81892bf78186ca2a74a4a4abfb292db to your computer and use it in GitHub Desktop.
Save jblebrun/b81892bf78186ca2a74a4a4abfb292db to your computer and use it in GitHub Desktop.
Weird struct/interface nesting causes stack overflow
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