Skip to content
Snippets Groups Projects

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
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading