-
Notifications
You must be signed in to change notification settings - Fork 316
Closed
Labels
Description
Describe the bug
Revive can flag a false empty-block positive where the block contents is irrelevant, but there's important functionality going on in the for loop controls for the block.
To Reproduce
cat <<EOF >main.go
package main
var count int
func step() (int, bool) {
// This could have all kinds of functionality.
count++
return count, count < 5
}
func main() {
for _, c := step(); c; _, c = step() {
// Here, the loop body is not important, the control using step() is.
}
}
EOF$ docker run -v "$(pwd)":/work ghcr.io/mgechev/revive:v1.13.0 ./work/main.go | grep empty
./work/main.go:12:39: this block is empty, you can remove itExpected behavior
No empty-block flagged.
Logs
N/A
Desktop (please complete the following information):
- OS: [e.g. Ubuntu 18.04]
- Version of Go
Using official revive Docker image.
Additional context
N/A
Reactions are currently unavailable