In the first example, "ok" was not printed.
func main() {
if(true) {
return
}
defer fmt.Println("ok")
}
So in the second example, is the Close function executed after an error occurs
and returned.
func main() {
src, err := os.Open("text.txt")
if err != nil {
return
}
defer src.Close()
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.