以下三道题都是defer关键字相关知识,首先在不运行代码的情况下给出返回值。 原文链接 题目 题目1 func f1() (result int) { defer func() { result++ }() return 0 } 题目2 func f2() (r int) { t := 5 defer func()