Skip to content

Commit 25fa42f

Browse files
adonovandennypenta
authored andcommitted
gopls/internal/analysis/yield: analyzer for iterator (yield) mistakes
This analyzer detects failure to check the result of a call to yield (which can cause a range loop to run beyond the sequence, leading to a panic). It is not always a mistake to ignore the result of a call to yield; it depends on whether control can reach another call to yield without checking that the first call returned true. Consequently, this analyzer uses SSA for control flow analysis. We plan to add this analyzer to gopls before we promote it to vet. + test, relnote Fixes golang/go#65795 Change-Id: I75fa272e2f546be0c2acb10a1978c82bc19db5bd Reviewed-on: https://go-review.googlesource.com/c/tools/+/609617 Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]> Commit-Queue: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 4296223 commit 25fa42f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gopls/internal/doc/api.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1353,4 +1353,4 @@
13531353
"Default": false
13541354
}
13551355
]
1356-
}
1356+
}

0 commit comments

Comments
 (0)