Skip to content

tidy: convert Fprintf to Fprintln when possible

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, use Fprintln instead.

Created with:

{
    "scopeQuery": "repo:github.com/sourcegraph/sourcegraph$",
    "matchTemplate":   "fmt.Fprintf(:[1], \":[2]\\n\")",
    "rewriteTemplate": "fmt.Fprintln(:[1], \":[2]\")"
}

Merge request reports

Loading