Skip to content

Commit 11f2e17

Browse files
vankleefjimsivchari
authored andcommitted
rename function literal to anonymous function to be more understandable
1 parent cc152e3 commit 11f2e17

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tenv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func checkFuncLit(pass *analysis.Pass, f *ast.FuncLit, fileName string) {
6363
if !ok {
6464
return
6565
}
66-
checkStmts(pass, f.Body.List, "function literal", argName)
66+
checkStmts(pass, f.Body.List, "anonymous function", argName)
6767
}
6868

6969
func checkStmts(pass *analysis.Pass, stmts []ast.Stmt, funcName, argName string) {

testdata/src/a/a_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ func FuzzF(f *testing.F) {
5959
func TestFunctionLiteral(t *testing.T) {
6060
testsetup()
6161
t.Run("test", func(t *testing.T) {
62-
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in function literal"
63-
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in function literal"
62+
os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in anonymous function"
63+
err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in anonymous function"
6464
_ = err
65-
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in function literal"
65+
if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in anonymous function"
6666
_ = err
6767
}
6868
})

0 commit comments

Comments
 (0)