Skip to content

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

Open
@cwedgwood

Description

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)

Activity

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

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions