A slice expression gives the length as its upper bound, which is the default

tx0/go:slice-to-lengthstrictwarningstyle

What it finds

s[i:len(s)]: the upper bound of a slice expression defaults to the length, so s[i:] says the same with less to read and nothing to get wrong.

Reported are two-index slice expressions whose upper bound is len of the sliced expression, which must have no calls. The fix removes the bound, which keeps what the expression does, so it is safe.

From the rule's source, slice_to_length.rs.

Example from the rule's tests
package p func f(s []int, i int) ([]int, []int) {	return s[i:len(s)], s[:len(s)-1]tx0 reports: the upper bound is the length, which is the default}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/go:slice-to-length" = "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:slice-to-length] reason="..."

tx0 explain tx0/go:slice-to-length shows the same in the terminal. Found a false positive? Report it.