tidy: convert Fprintf to Fprintln when possible
requested to merge sourcegraph/tidy-convert-fprintf-to-fprintln-when-possible-1576174509 into master
Created by: rvantonder
When the second argument to Fprintf
contains no format specifiers (AKA "verbs"), use Fprint
instead.
In our codebase, every pattern that matched the above also contains a \n
at the end of the string, so we can further simplify the above and say that:
- if the string also ends with
\n
, useFprintln
instead.
Created with:
{
"scopeQuery": "repo:github.com/sourcegraph/sourcegraph$",
"matchTemplate": "fmt.Fprintf(:[1], \":[2]\\n\")",
"rewriteTemplate": "fmt.Fprintln(:[1], \":[2]\")"
}