Skip to content

x/tools/go/analysis: add check for redundant maps.Keys/Values calls in range statements #72908

Closed
@kwjw

Description

@kwjw

Range statements like

for k := range maps.Keys(m) {}
for v := range maps.Values(m) {}

should be replaced with

for k := range m {}
for _, v := range m {}

respectively.

Possibly in scope is making similar corrections for the slice-based Keys/Values functions in x/exp/maps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolToolsThis 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