A constant string is formatted without arguments, which gives the string itself
What it finds
fmt.Sprintf("ready") formats a string that has no verbs, with nothing to format, so it returns the string as it is, after a pass over it at run time. The literal says the same.
Reported are calls of fmt.Sprintf and fmt.Sprint with a single string literal that contains no %. The fix replaces the call with the literal, and is safe.
From the rule's source, sprintf_without_arguments.rs.
package p import "fmt" var ready = fmt.Sprintf("ready")tx0 reports: the call returns the literal unchanged var percent = fmt.Sprintf("100%%") 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:sprintf-without-arguments" = "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:sprintf-without-arguments] reason="..."tx0 explain tx0/go:sprintf-without-arguments shows the same in the terminal. Found a false positive? Report it.