Control jumps to a label with goto
What it finds
goto retry: a jump to a label makes the reader find the label and work out the state at both ends, where a loop, break or continue, or a function says the same with a structure. Generated code and a few low-level packages use it on purpose.
Reported is every goto statement.
From the rule's source, goto_statement.rs.
package p func retry(try func() bool) {again: if !try() { goto againtx0 reports: goto jumps to a label }} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/go:goto-statement" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/go:goto-statement] reason="..."tx0 explain tx0/go:goto-statement shows the same in the terminal. Found a false positive? Report it.