Skip to content

Instantly share code, notes, and snippets.

@sunbuhui
Last active December 23, 2020 04:54
Show Gist options
  • Save sunbuhui/ad8f630bea74774d0ce3842474097c16 to your computer and use it in GitHub Desktop.
Save sunbuhui/ad8f630bea74774d0ce3842474097c16 to your computer and use it in GitHub Desktop.
My Golang cookbool
#Defer
#A defer statement defers the execution of a function until the surrounding function returns.
#The deferred call's arguments are evaluated immediately, but the function call is not executed until the surrounding function returns.
package main
import "fmt"
func main() {
defer fmt.Println("world")
fmt.Println("hello")
}
# Remember go defer stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment