A loop has the condition true, which it needs not
What it finds
for true { ... }: a for without a condition loops until something leaves it, so the constant condition only adds a word to read.
Reported are loops whose only clause is the predeclared true. The fix removes it, which keeps what the loop does, so it is safe.
From the rule's source, for_true.rs.
package p func f(c chan int) { for true {tx0 reports: for true loops just like for without a condition <-c }} 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:for-true" = "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:for-true] reason="..."tx0 explain tx0/go:for-true shows the same in the terminal. Found a false positive? Report it.