Skip to content

x/tools/gopls: add analyzer to simplify slice to array conversions #69820

@dsnet

Description

@dsnet

Go version

go1.23.1

Output of go env in your module/workspace:

n/a

What did you do?

Run gofmt -s

What did you see happen?

Nothing.

What did you expect to see?

Rewrite of *(*logid.PublicID)(buf) to logid.PublicID(buf). Where logid.PublicID is an [...]byte type and buf is an []byte.

Go 1.17 introduced conversion of slices to array pointers, which resulted in code of the *(*A)(s) pattern. Go 1.20 introduced direct conversion of a slice to an array, thus making the *(*A)(s) pattern redundant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions