A strconv function is given a base or bit size it does not accept

tx0/go:invalid-strconv-sizedefaultwarningbug

What it finds

strconv.ParseInt(s, 10, 128): the bit size of the parsing functions of strconv says which Go type the result must fit, and the base must be 0 or between 2 and 36. ParseInt and ParseUint return an error for a bit size above 64 or another base, whatever the input, and FormatInt, FormatUint, AppendInt and AppendUint panic for a base outside 2 to 36. ParseFloat knows the bit sizes 32 and 64 and ParseComplex 64 and 128; they take any other as the larger one.

Checked are integer literals given as the base or bit size of these functions of strconv, resolved through the imports.

From the rule's source, invalid_strconv_size.rs.

Example from the rule's tests
package p import "strconv" func f(s string, n int64) {	_, _ = strconv.ParseInt(s, 10, 128)tx0 reports: does not accept the bit size 128	_, _ = strconv.ParseUint(s, 1, 64)tx0 reports: does not accept the base 1	_, _ = strconv.ParseInt(s, 0, 0)	_, _ = strconv.ParseInt(s, 36, 7)	_, _ = strconv.ParseFloat(s, 16)tx0 reports: has no bit size 16 and takes it as 64	_, _ = strconv.ParseFloat(s, 32)	_ = strconv.FormatInt(n, 37)tx0 reports: strconv.FormatInt panics for the base 37	_ = strconv.FormatInt(n, 16)}
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 in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/go:invalid-strconv-size" = "off"

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:invalid-strconv-size] reason="..."

tx0 explain tx0/go:invalid-strconv-size shows the same in the terminal. Found a false positive? Report it.