Skip to content

defer

go
func main() {
	defer func() {
		fmt.Println("cleanup")
	}()

	fmt.Println("running")
}

警告

() 必须存在,也就是说必须是一个函数调用。