Last active
October 12, 2016 22:27
-
-
Save mlowicki/ca8f505a78e49c115adec6c53f252837 to your computer and use it in GitHub Desktop.
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 | |
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