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

Feature Request: detect & suggest (os.File).Write([]byte("normal looking string")) -> (os.File).WriteString("normal looking string") #1601

Open
cwedgwood opened this issue Sep 10, 2024 · 1 comment

Comments

@cwedgwood
Copy link

I noticed in a few local code bases here frequent use of a pattern along the lines of:

var f os.File
f.Write([]byte("# do not edit\n"))

and wonder if in some (not all) circumstances we can determine if these strings either as constants or by use are essentially human readable in which case we could have:

var f os.File
f.WriteString("# do not edit\n")

(Internally WriteString uses unsafe to avoid allocation and copy)

@cwedgwood cwedgwood added the needs-triage Newly filed issue that needs triage label Sep 10, 2024
@dominikh dominikh added new-check and removed needs-triage Newly filed issue that needs triage labels Sep 10, 2024
@ccoVeille
Copy link

ccoVeille commented Sep 14, 2024

Looks like what https://github.com/butuzov/mirror is about

(Hi @butuzov 👋)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants