Details
Description
RSPEC-1763 currently says
Jump statements (return, break, continue, goto) and throw expressions move control flow out of the current code block. So any unlabelled statements that come after a jump are dead code.
The rule currently raises false positive when code following a jump statement is labelled.
func fn(myvar int) int { if (myvar > 10) { goto Foo } return 42 // False positive Foo: fmt.Println("Hello world") return 21 }
Attachments
Issue Links
- implements
-
RSPEC-1763 All code should be reachable
- Active
- is duplicated by
-
SONARSLANG-439 [Go] S1763 FP on function with label
-
- Closed
-
- relates to
-
SONARSLANG-510 [Slang] - Add support for Labels and GOTO
-
- Open
-