Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzing sprintf patterns #348

Open
quasilyte opened this issue Jan 5, 2022 · 0 comments
Open

Analyzing sprintf patterns #348

quasilyte opened this issue Jan 5, 2022 · 0 comments

Comments

@quasilyte
Copy link
Owner

Figure out whether there is a sensible way to recognize this pattern as something that can be rewritten with "+":

fmt.Sprintf("DirAvailable-%s", strings.Replace(dac.Path, "/", "-", -1))

Basically, we need to:

  1. Detect that a format string ends with %s and has no other formatting directives (can be done with Text.Matches)
  2. Suggest "DirAvailable-" + strings.Replace(dac.Path, "/", "-", -1) and the hard part is to trim %s from the format string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant