Skip to content

Instantly share code, notes, and snippets.

@mlowicki
Last active October 12, 2016 22:27
Show Gist options
  • Save mlowicki/ca8f505a78e49c115adec6c53f252837 to your computer and use it in GitHub Desktop.
Save mlowicki/ca8f505a78e49c115adec6c53f252837 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func f(ch chan int) {
defer func() {
fmt.Println("Deferred by f")
}()
g()
ch <- 0
}
func g() {
defer func() {
fmt.Println("Deferred by g")
}()
h()
}
func h() {
defer func() {
fmt.Println("Deferred by h")
}()
panic("boom!")
}
func main() {
ch := make(chan int)
go f(ch)
<-ch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment