x/tools/gopls: add analyzer to simplify slice to array conversions #69820
Labels
gopls
Issues related to the Go language server, gopls.
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Go version
go1.23.1
Output of
go env
in your module/workspace:What did you do?
Run
gofmt -s
What did you see happen?
Nothing.
What did you expect to see?
Rewrite of
*(*logid.PublicID)(buf)
tologid.PublicID(buf)
. Wherelogid.PublicID
is an[...]byte
type andbuf
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.The text was updated successfully, but these errors were encountered: